From 56ac512d01fc508e499d7b516e1b495ce6ae9a77 Mon Sep 17 00:00:00 2001 From: JiahuiPeng <46921893+804873052@users.noreply.github.com> Date: Thu, 2 Sep 2021 17:36:19 +0800 Subject: [PATCH] Release track 2 `armcompute` v0.3.0 (#15426) * [Release] sdk/compute/armcompute/0.2.1 generation from spec commit: d5ad9431bbc19c34090d97209eb497167db32879 * fix exmaple * goimports * fix * fix * fix * fix CHANGELOG release date * fix --- sdk/compute/armcompute/CHANGELOG.md | 7 +- sdk/compute/armcompute/README.md | 10 +- sdk/compute/armcompute/_meta.json | 11 - sdk/compute/armcompute/autorest.md | 11 + sdk/compute/armcompute/build.go | 7 + sdk/compute/armcompute/ci.yml | 2 +- .../example_availabilitysets_test.go | 11 +- sdk/compute/armcompute/example_disks_test.go | 11 +- .../example_virtualmachineextensions_test.go | 11 +- .../example_virtualmachines_test.go | 25 +- .../example_virtualmachinescalesets_test.go | 21 +- sdk/compute/armcompute/go.mod | 10 +- sdk/compute/armcompute/go.sum | 52 +- sdk/compute/armcompute/go_mod_tidy_hack.go | 1 + .../zz_generated_availabilitysets_client.go | 331 +- ...erated_capacityreservationgroups_client.go | 413 + ...z_generated_capacityreservations_client.go | 419 + ...ted_cloudserviceoperatingsystems_client.go | 202 +- ...erated_cloudserviceroleinstances_client.go | 475 +- .../zz_generated_cloudserviceroles_client.go | 109 +- .../zz_generated_cloudservices_client.go | 855 +- ...erated_cloudservicesupdatedomain_client.go | 184 +- .../armcompute/zz_generated_constants.go | 133 +- ...zz_generated_dedicatedhostgroups_client.go | 286 +- .../zz_generated_dedicatedhosts_client.go | 326 +- .../zz_generated_diskaccesses_client.go | 656 +- .../zz_generated_diskencryptionsets_client.go | 424 +- .../zz_generated_diskrestorepoint_client.go | 278 +- .../armcompute/zz_generated_disks_client.go | 500 +- .../zz_generated_galleries_client.go | 388 +- ...zz_generated_galleryapplications_client.go | 338 +- ...rated_galleryapplicationversions_client.go | 338 +- .../zz_generated_galleryimages_client.go | 338 +- ...z_generated_galleryimageversions_client.go | 338 +- ..._generated_gallerysharingprofile_client.go | 93 +- .../armcompute/zz_generated_images_client.go | 374 +- .../zz_generated_loganalytics_client.go | 164 +- sdk/compute/armcompute/zz_generated_models.go | 602 +- .../zz_generated_operations_client.go | 61 +- sdk/compute/armcompute/zz_generated_pagers.go | 3370 ++++---- .../armcompute/zz_generated_pollers.go | 5168 ++++++++++-- ...nerated_proximityplacementgroups_client.go | 286 +- .../zz_generated_resourceskus_client.go | 67 +- .../armcompute/zz_generated_response_types.go | 7410 +++++++++++++++-- ...enerated_restorepointcollections_client.go | 336 +- .../zz_generated_restorepoints_client.go | 213 +- .../zz_generated_sharedgalleries_client.go | 113 +- ...zz_generated_sharedgalleryimages_client.go | 113 +- ...rated_sharedgalleryimageversions_client.go | 113 +- .../zz_generated_snapshots_client.go | 500 +- .../zz_generated_sshpublickeys_client.go | 331 +- .../armcompute/zz_generated_time_rfc3339.go | 3 +- .../armcompute/zz_generated_usage_client.go | 64 +- ...ed_virtualmachineextensionimages_client.go | 151 +- ...nerated_virtualmachineextensions_client.go | 323 +- ...z_generated_virtualmachineimages_client.go | 241 +- ...ted_virtualmachineimagesedgezone_client.go | 251 +- ...erated_virtualmachineruncommands_client.go | 431 +- .../zz_generated_virtualmachines_client.go | 1553 ++-- ...virtualmachinescalesetextensions_client.go | 326 +- ...almachinescalesetrollingupgrades_client.go | 270 +- ...enerated_virtualmachinescalesets_client.go | 1428 ++-- ...rtualmachinescalesetvmextensions_client.go | 335 +- ...tualmachinescalesetvmruncommands_client.go | 338 +- ...erated_virtualmachinescalesetvms_client.go | 1007 +-- ...zz_generated_virtualmachinesizes_client.go | 61 +- 66 files changed, 21055 insertions(+), 12562 deletions(-) delete mode 100644 sdk/compute/armcompute/_meta.json create mode 100644 sdk/compute/armcompute/autorest.md create mode 100644 sdk/compute/armcompute/build.go create mode 100644 sdk/compute/armcompute/zz_generated_capacityreservationgroups_client.go create mode 100644 sdk/compute/armcompute/zz_generated_capacityreservations_client.go diff --git a/sdk/compute/armcompute/CHANGELOG.md b/sdk/compute/armcompute/CHANGELOG.md index c6b27ef64c9c..cc4e8f684dea 100644 --- a/sdk/compute/armcompute/CHANGELOG.md +++ b/sdk/compute/armcompute/CHANGELOG.md @@ -1,6 +1,9 @@ # Release History -## v0.2.0 (released) +## v0.3.0 (2021-09-03) Updated with the latest track 2 code generator. -## v0.1.0 (released) +## v0.2.0 (2021-06-18) +Updated with the latest track 2 code generator. + +## v0.1.0 (2021-05-26) diff --git a/sdk/compute/armcompute/README.md b/sdk/compute/armcompute/README.md index f11bb9e97fa0..bddcfeef382d 100644 --- a/sdk/compute/armcompute/README.md +++ b/sdk/compute/armcompute/README.md @@ -2,7 +2,7 @@ [![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/compute/armcompute)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/compute/armcompute) -The `armcompute` module provides operations for working with Azure compute. +The `armcompute` module provides operations for working with Azure Compute. [Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/compute/armcompute) @@ -35,17 +35,17 @@ For more information on authentication, please see the documentation for `aziden ## Connecting to Azure Compute -Once you have a credential, create a connection to the desired ARM endpoint. The `armcore` module provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. ```go -con := armcore.NewDefaultConnection(cred, nil) +con := arm.NewDefaultConnection(cred, nil) ``` -For more information on ARM connections, please see the documentation for `armcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/armcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/armcore). +For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ## Clients -Azure Compute modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `armcore.Connection`. +Azure Compute modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. ```go client := armcompute.NewVirtualMachinesClient(con, "") diff --git a/sdk/compute/armcompute/_meta.json b/sdk/compute/armcompute/_meta.json deleted file mode 100644 index c751009ce0af..000000000000 --- a/sdk/compute/armcompute/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "f69f2e8053ac8ae352b11c33655234dea4cf4cfd", - "readme": "/_/azure-rest-api-specs/specification/compute/resource-manager/readme.md", - "tag": "package-2021-03-01", - "use": "@autorest/go@4.0.0-preview.22", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@autorest/go@4.0.0-preview.22 --version:3.2.1 --go --track2 --go-sdk-folder=/_/azure-sdk-for-go --file-prefix=\"zz_generated_\" --clear-output-folder=false /_/azure-rest-api-specs/specification/compute/resource-manager/readme.md", - "additional_properties": { - "additional_options": " --version:3.2.1 --go --track2 --file-prefix=\"zz_generated_\" --clear-output-folder=false" - } -} \ No newline at end of file diff --git a/sdk/compute/armcompute/autorest.md b/sdk/compute/armcompute/autorest.md new file mode 100644 index 000000000000..47e4d8986eaa --- /dev/null +++ b/sdk/compute/armcompute/autorest.md @@ -0,0 +1,11 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +require: +- https://github.com/Azure/azure-rest-api-specs/blob/d5ad9431bbc19c34090d97209eb497167db32879/specification/compute/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/d5ad9431bbc19c34090d97209eb497167db32879/specification/compute/resource-manager/readme.go.md +module-version: 0.3.0 + +``` \ No newline at end of file diff --git a/sdk/compute/armcompute/build.go b/sdk/compute/armcompute/build.go new file mode 100644 index 000000000000..46f02163e856 --- /dev/null +++ b/sdk/compute/armcompute/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh.exe ../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate armcompute + +package armcompute diff --git a/sdk/compute/armcompute/ci.yml b/sdk/compute/armcompute/ci.yml index 0d41291c2072..6a2747b61858 100644 --- a/sdk/compute/armcompute/ci.yml +++ b/sdk/compute/armcompute/ci.yml @@ -10,6 +10,6 @@ pr: - sdk/compute/armcompute/ stages: -- template: ../../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml parameters: ServiceDirectory: 'compute/armcompute' diff --git a/sdk/compute/armcompute/example_availabilitysets_test.go b/sdk/compute/armcompute/example_availabilitysets_test.go index 3d00f9af2f67..333c0a22b490 100644 --- a/sdk/compute/armcompute/example_availabilitysets_test.go +++ b/sdk/compute/armcompute/example_availabilitysets_test.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,10 +10,10 @@ import ( "context" "log" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/to" ) func ExampleAvailabilitySetsClient_CreateOrUpdate() { @@ -20,7 +21,7 @@ func ExampleAvailabilitySetsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewAvailabilitySetsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewAvailabilitySetsClient(arm.NewDefaultConnection(cred, nil), "") resp, err := client.CreateOrUpdate( context.Background(), "", @@ -51,7 +52,7 @@ func ExampleAvailabilitySetsClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewAvailabilitySetsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewAvailabilitySetsClient(arm.NewDefaultConnection(cred, nil), "") resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/compute/armcompute/example_disks_test.go b/sdk/compute/armcompute/example_disks_test.go index 0395b5a4d5e7..6414f33663f3 100644 --- a/sdk/compute/armcompute/example_disks_test.go +++ b/sdk/compute/armcompute/example_disks_test.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,10 +11,10 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/to" ) func ExampleDisksClient_BeginCreateOrUpdate() { @@ -21,7 +22,7 @@ func ExampleDisksClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewDisksClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewDisksClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -55,7 +56,7 @@ func ExampleDisksClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewDisksClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewDisksClient(arm.NewDefaultConnection(cred, nil), "") resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/compute/armcompute/example_virtualmachineextensions_test.go b/sdk/compute/armcompute/example_virtualmachineextensions_test.go index e2eafccaf4c5..38e80771a7c6 100644 --- a/sdk/compute/armcompute/example_virtualmachineextensions_test.go +++ b/sdk/compute/armcompute/example_virtualmachineextensions_test.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,10 +12,10 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/to" ) func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate() { @@ -22,7 +23,7 @@ func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineExtensionsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineExtensionsClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -69,7 +70,7 @@ func ExampleVirtualMachineExtensionsClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineExtensionsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineExtensionsClient(arm.NewDefaultConnection(cred, nil), "") resp, err := client.Get(context.Background(), "", "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/compute/armcompute/example_virtualmachines_test.go b/sdk/compute/armcompute/example_virtualmachines_test.go index 9e13f78086b9..59d4182d739c 100644 --- a/sdk/compute/armcompute/example_virtualmachines_test.go +++ b/sdk/compute/armcompute/example_virtualmachines_test.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,10 +12,10 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/to" ) func ExampleVirtualMachinesClient_BeginCreateOrUpdate() { @@ -24,7 +25,7 @@ func ExampleVirtualMachinesClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -94,7 +95,7 @@ func ExampleVirtualMachinesClient_BeginCreateOrUpdate_withDisk() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -172,7 +173,7 @@ func ExampleVirtualMachinesClient_BeginCreateOrUpdate_withLoadBalancer() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -235,7 +236,7 @@ func ExampleVirtualMachinesClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -248,7 +249,7 @@ func ExampleVirtualMachinesClient_BeginDeallocate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginDeallocate(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -264,7 +265,7 @@ func ExampleVirtualMachinesClient_BeginUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginUpdate( context.Background(), "", @@ -294,7 +295,7 @@ func ExampleVirtualMachinesClient_BeginStart() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginStart( context.Background(), "", @@ -315,7 +316,7 @@ func ExampleVirtualMachinesClient_BeginRestart() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginRestart( context.Background(), "", @@ -336,7 +337,7 @@ func ExampleVirtualMachinesClient_BeginPowerOff() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginPowerOff( context.Background(), "", diff --git a/sdk/compute/armcompute/example_virtualmachinescalesets_test.go b/sdk/compute/armcompute/example_virtualmachinescalesets_test.go index c45f1ee6de4c..46fc4158ab27 100644 --- a/sdk/compute/armcompute/example_virtualmachinescalesets_test.go +++ b/sdk/compute/armcompute/example_virtualmachinescalesets_test.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,10 +12,10 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/compute/armcompute" - "github.com/Azure/azure-sdk-for-go/sdk/to" ) func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate() { @@ -32,7 +33,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -120,7 +121,7 @@ func ExampleVirtualMachineScaleSetsClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -133,7 +134,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginUpdate( context.Background(), "", @@ -163,7 +164,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginDeallocate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginDeallocate(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -179,7 +180,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginStart() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginStart(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -195,7 +196,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginRestart() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginRestart(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -211,7 +212,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginPowerOff() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(armcore.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") poller, err := client.BeginPowerOff(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/compute/armcompute/go.mod b/sdk/compute/armcompute/go.mod index 738488e26f25..850d35e4e36d 100644 --- a/sdk/compute/armcompute/go.mod +++ b/sdk/compute/armcompute/go.mod @@ -1,11 +1,9 @@ module github.com/Azure/azure-sdk-for-go/sdk/compute/armcompute -go 1.13 +go 1.16 require ( - github.com/Azure/azure-sdk-for-go v55.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/armcore v0.8.0 - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.16.2 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.9.1 - github.com/Azure/azure-sdk-for-go/sdk/to v0.1.4 + github.com/Azure/azure-sdk-for-go v57.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.10.0 ) diff --git a/sdk/compute/armcompute/go.sum b/sdk/compute/armcompute/go.sum index 181427723a13..ea02bcb04f8a 100644 --- a/sdk/compute/armcompute/go.sum +++ b/sdk/compute/armcompute/go.sum @@ -1,31 +1,41 @@ -github.com/Azure/azure-sdk-for-go v55.2.0+incompatible h1:TL2/vJWJEPOrmv97nHcbvjXES0Ntlb9P95hqGA1J2dU= -github.com/Azure/azure-sdk-for-go v55.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/armcore v0.8.0 h1:HQQoaSGOh32mpoRkpLDjkngMwYJqkxu93FRx0epdLHE= -github.com/Azure/azure-sdk-for-go/sdk/armcore v0.8.0/go.mod h1:BSKvHb/5cy8j4hahIInXH92X/2zGJ3TxKF6b9pw1Btg= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.14.0/go.mod h1:pElNP+u99BvCZD+0jOlhI9OC/NB2IDTOTGZOZH0Qhq8= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.16.2 h1:UC4vfOhW2l0f2QOCQpOxJS4/K6oKFy2tQZE+uWU1MEo= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.16.2/go.mod h1:MVdrcUC4Hup35qHym3VdzoW+NBgBxrta9Vei97jRtM8= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.9.1 h1:KchdKK3XlOjkzBROV+q3D+YgfRTvwoeBwbaoX4aVkjI= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.9.1/go.mod h1:acANgl9stsT5xflESXKjZx4rhZJSr0TGgTDYY0xJPIE= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.0/go.mod h1:k4KbFSunV/+0hOHL1vyFaPsiYQ1Vmvy1TBpmtvCDLZM= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.1 h1:vx8McI56N5oLSQu8xa+xdiE0fjQq8W8Zt49vHP8Rygw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.5.1/go.mod h1:k4KbFSunV/+0hOHL1vyFaPsiYQ1Vmvy1TBpmtvCDLZM= -github.com/Azure/azure-sdk-for-go/sdk/to v0.1.4 h1:3w4gk+uYOwplGhID1fDP305/8bI5Aug3URoC1V493KU= -github.com/Azure/azure-sdk-for-go/sdk/to v0.1.4/go.mod h1:UL/d4lvWAzSJUuX+19uKdN0ktyjoOyQhgY+HWNgtIYI= +github.com/Azure/azure-sdk-for-go v57.0.0+incompatible h1:isVki3PbIFrwKvKdVP1byxo73/pt+Nn174YxW1k4PNw= +github.com/Azure/azure-sdk-for-go v57.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.10.0 h1:jq5Urf8QJK6h0wr8CMiwggo4OSMkXwpArQlkSjSpaBk= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.10.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= +golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/compute/armcompute/go_mod_tidy_hack.go b/sdk/compute/armcompute/go_mod_tidy_hack.go index 64a6cb5b0234..479f35aee2d9 100644 --- a/sdk/compute/armcompute/go_mod_tidy_hack.go +++ b/sdk/compute/armcompute/go_mod_tidy_hack.go @@ -1,3 +1,4 @@ +//go:build modhack // +build modhack // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/sdk/compute/armcompute/zz_generated_availabilitysets_client.go b/sdk/compute/armcompute/zz_generated_availabilitysets_client.go index 79f73e38eade..b83978956a9a 100644 --- a/sdk/compute/armcompute/zz_generated_availabilitysets_client.go +++ b/sdk/compute/armcompute/zz_generated_availabilitysets_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,44 +11,47 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // AvailabilitySetsClient contains the methods for the AvailabilitySets group. // Don't use this type directly, use NewAvailabilitySetsClient() instead. type AvailabilitySetsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewAvailabilitySetsClient creates a new instance of AvailabilitySetsClient with the specified values. -func NewAvailabilitySetsClient(con *armcore.Connection, subscriptionID string) *AvailabilitySetsClient { - return &AvailabilitySetsClient{con: con, subscriptionID: subscriptionID} +func NewAvailabilitySetsClient(con *arm.Connection, subscriptionID string) *AvailabilitySetsClient { + return &AvailabilitySetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // CreateOrUpdate - Create or update an availability set. // If the operation fails it returns a generic error. -func (client *AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet, options *AvailabilitySetsCreateOrUpdateOptions) (AvailabilitySetResponse, error) { +func (client *AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet, options *AvailabilitySetsCreateOrUpdateOptions) (AvailabilitySetsCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, availabilitySetName, parameters, options) if err != nil { - return AvailabilitySetResponse{}, err + return AvailabilitySetsCreateOrUpdateResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return AvailabilitySetResponse{}, err + return AvailabilitySetsCreateOrUpdateResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return AvailabilitySetResponse{}, client.createOrUpdateHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) } return client.createOrUpdateHandleResponse(resp) } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet, options *AvailabilitySetsCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySet, options *AvailabilitySetsCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -61,58 +65,57 @@ func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *AvailabilitySetsClient) createOrUpdateHandleResponse(resp *azcore.Response) (AvailabilitySetResponse, error) { - var val *AvailabilitySet - if err := resp.UnmarshalAsJSON(&val); err != nil { - return AvailabilitySetResponse{}, err +func (client *AvailabilitySetsClient) createOrUpdateHandleResponse(resp *http.Response) (AvailabilitySetsCreateOrUpdateResponse, error) { + result := AvailabilitySetsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySet); err != nil { + return AvailabilitySetsCreateOrUpdateResponse{}, err } - return AvailabilitySetResponse{RawResponse: resp.Response, AvailabilitySet: val}, nil + return result, nil } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *AvailabilitySetsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *AvailabilitySetsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Delete - Delete an availability set. // If the operation fails it returns a generic error. -func (client *AvailabilitySetsClient) Delete(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsDeleteOptions) (*http.Response, error) { +func (client *AvailabilitySetsClient) Delete(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsDeleteOptions) (AvailabilitySetsDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, availabilitySetName, options) if err != nil { - return nil, err + return AvailabilitySetsDeleteResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return nil, err + return AvailabilitySetsDeleteResponse{}, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusNoContent) { - return nil, client.deleteHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AvailabilitySetsDeleteResponse{}, client.deleteHandleError(resp) } - return resp.Response, nil + return AvailabilitySetsDeleteResponse{RawResponse: resp}, nil } // deleteCreateRequest creates the Delete request. -func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsDeleteOptions) (*azcore.Request, error) { +func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -126,48 +129,47 @@ func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, r return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *AvailabilitySetsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *AvailabilitySetsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Retrieves information about an availability set. // If the operation fails it returns a generic error. -func (client *AvailabilitySetsClient) Get(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsGetOptions) (AvailabilitySetResponse, error) { +func (client *AvailabilitySetsClient) Get(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsGetOptions) (AvailabilitySetsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, availabilitySetName, options) if err != nil { - return AvailabilitySetResponse{}, err + return AvailabilitySetsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return AvailabilitySetResponse{}, err + return AvailabilitySetsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return AvailabilitySetResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsGetOptions) (*azcore.Request, error) { +func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -181,58 +183,54 @@ func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, reso return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *AvailabilitySetsClient) getHandleResponse(resp *azcore.Response) (AvailabilitySetResponse, error) { - var val *AvailabilitySet - if err := resp.UnmarshalAsJSON(&val); err != nil { - return AvailabilitySetResponse{}, err +func (client *AvailabilitySetsClient) getHandleResponse(resp *http.Response) (AvailabilitySetsGetResponse, error) { + result := AvailabilitySetsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySet); err != nil { + return AvailabilitySetsGetResponse{}, err } - return AvailabilitySetResponse{RawResponse: resp.Response, AvailabilitySet: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *AvailabilitySetsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *AvailabilitySetsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - Lists all availability sets in a resource group. // If the operation fails it returns a generic error. -func (client *AvailabilitySetsClient) List(resourceGroupName string, options *AvailabilitySetsListOptions) AvailabilitySetListResultPager { - return &availabilitySetListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *AvailabilitySetsClient) List(resourceGroupName string, options *AvailabilitySetsListOptions) *AvailabilitySetsListPager { + return &AvailabilitySetsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp AvailabilitySetListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.AvailabilitySetListResult.NextLink) + advancer: func(ctx context.Context, resp AvailabilitySetsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AvailabilitySetListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *AvailabilitySetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *AvailabilitySetsListOptions) (*azcore.Request, error) { +func (client *AvailabilitySetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *AvailabilitySetsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -242,58 +240,57 @@ func (client *AvailabilitySetsClient) listCreateRequest(ctx context.Context, res return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *AvailabilitySetsClient) listHandleResponse(resp *azcore.Response) (AvailabilitySetListResultResponse, error) { - var val *AvailabilitySetListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return AvailabilitySetListResultResponse{}, err +func (client *AvailabilitySetsClient) listHandleResponse(resp *http.Response) (AvailabilitySetsListResponse, error) { + result := AvailabilitySetsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySetListResult); err != nil { + return AvailabilitySetsListResponse{}, err } - return AvailabilitySetListResultResponse{RawResponse: resp.Response, AvailabilitySetListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *AvailabilitySetsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *AvailabilitySetsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListAvailableSizes - Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. // If the operation fails it returns a generic error. -func (client *AvailabilitySetsClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsListAvailableSizesOptions) (VirtualMachineSizeListResultResponse, error) { +func (client *AvailabilitySetsClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsListAvailableSizesOptions) (AvailabilitySetsListAvailableSizesResponse, error) { req, err := client.listAvailableSizesCreateRequest(ctx, resourceGroupName, availabilitySetName, options) if err != nil { - return VirtualMachineSizeListResultResponse{}, err + return AvailabilitySetsListAvailableSizesResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineSizeListResultResponse{}, err + return AvailabilitySetsListAvailableSizesResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineSizeListResultResponse{}, client.listAvailableSizesHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsListAvailableSizesResponse{}, client.listAvailableSizesHandleError(resp) } return client.listAvailableSizesHandleResponse(resp) } // listAvailableSizesCreateRequest creates the ListAvailableSizes request. -func (client *AvailabilitySetsClient) listAvailableSizesCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsListAvailableSizesOptions) (*azcore.Request, error) { +func (client *AvailabilitySetsClient) listAvailableSizesCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, options *AvailabilitySetsListAvailableSizesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -307,118 +304,113 @@ func (client *AvailabilitySetsClient) listAvailableSizesCreateRequest(ctx contex return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listAvailableSizesHandleResponse handles the ListAvailableSizes response. -func (client *AvailabilitySetsClient) listAvailableSizesHandleResponse(resp *azcore.Response) (VirtualMachineSizeListResultResponse, error) { - var val *VirtualMachineSizeListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineSizeListResultResponse{}, err +func (client *AvailabilitySetsClient) listAvailableSizesHandleResponse(resp *http.Response) (AvailabilitySetsListAvailableSizesResponse, error) { + result := AvailabilitySetsListAvailableSizesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineSizeListResult); err != nil { + return AvailabilitySetsListAvailableSizesResponse{}, err } - return VirtualMachineSizeListResultResponse{RawResponse: resp.Response, VirtualMachineSizeListResult: val}, nil + return result, nil } // listAvailableSizesHandleError handles the ListAvailableSizes error response. -func (client *AvailabilitySetsClient) listAvailableSizesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *AvailabilitySetsClient) listAvailableSizesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListBySubscription - Lists all availability sets in a subscription. // If the operation fails it returns a generic error. -func (client *AvailabilitySetsClient) ListBySubscription(options *AvailabilitySetsListBySubscriptionOptions) AvailabilitySetListResultPager { - return &availabilitySetListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *AvailabilitySetsClient) ListBySubscription(options *AvailabilitySetsListBySubscriptionOptions) *AvailabilitySetsListBySubscriptionPager { + return &AvailabilitySetsListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listBySubscriptionCreateRequest(ctx, options) }, - responder: client.listBySubscriptionHandleResponse, - errorer: client.listBySubscriptionHandleError, - advancer: func(ctx context.Context, resp AvailabilitySetListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.AvailabilitySetListResult.NextLink) + advancer: func(ctx context.Context, resp AvailabilitySetsListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.AvailabilitySetListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AvailabilitySetsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AvailabilitySetsListBySubscriptionOptions) (*azcore.Request, error) { +func (client *AvailabilitySetsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AvailabilitySetsListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *AvailabilitySetsClient) listBySubscriptionHandleResponse(resp *azcore.Response) (AvailabilitySetListResultResponse, error) { - var val *AvailabilitySetListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return AvailabilitySetListResultResponse{}, err +func (client *AvailabilitySetsClient) listBySubscriptionHandleResponse(resp *http.Response) (AvailabilitySetsListBySubscriptionResponse, error) { + result := AvailabilitySetsListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySetListResult); err != nil { + return AvailabilitySetsListBySubscriptionResponse{}, err } - return AvailabilitySetListResultResponse{RawResponse: resp.Response, AvailabilitySetListResult: val}, nil + return result, nil } // listBySubscriptionHandleError handles the ListBySubscription error response. -func (client *AvailabilitySetsClient) listBySubscriptionHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *AvailabilitySetsClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Update - Update an availability set. // If the operation fails it returns a generic error. -func (client *AvailabilitySetsClient) Update(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate, options *AvailabilitySetsUpdateOptions) (AvailabilitySetResponse, error) { +func (client *AvailabilitySetsClient) Update(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate, options *AvailabilitySetsUpdateOptions) (AvailabilitySetsUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, availabilitySetName, parameters, options) if err != nil { - return AvailabilitySetResponse{}, err + return AvailabilitySetsUpdateResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return AvailabilitySetResponse{}, err + return AvailabilitySetsUpdateResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return AvailabilitySetResponse{}, client.updateHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AvailabilitySetsUpdateResponse{}, client.updateHandleError(resp) } return client.updateHandleResponse(resp) } // updateCreateRequest creates the Update request. -func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate, options *AvailabilitySetsUpdateOptions) (*azcore.Request, error) { +func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetName string, parameters AvailabilitySetUpdate, options *AvailabilitySetsUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -432,35 +424,34 @@ func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, r return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // updateHandleResponse handles the Update response. -func (client *AvailabilitySetsClient) updateHandleResponse(resp *azcore.Response) (AvailabilitySetResponse, error) { - var val *AvailabilitySet - if err := resp.UnmarshalAsJSON(&val); err != nil { - return AvailabilitySetResponse{}, err +func (client *AvailabilitySetsClient) updateHandleResponse(resp *http.Response) (AvailabilitySetsUpdateResponse, error) { + result := AvailabilitySetsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySet); err != nil { + return AvailabilitySetsUpdateResponse{}, err } - return AvailabilitySetResponse{RawResponse: resp.Response, AvailabilitySet: val}, nil + return result, nil } // updateHandleError handles the Update error response. -func (client *AvailabilitySetsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *AvailabilitySetsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_capacityreservationgroups_client.go b/sdk/compute/armcompute/zz_generated_capacityreservationgroups_client.go new file mode 100644 index 000000000000..e870da898f1a --- /dev/null +++ b/sdk/compute/armcompute/zz_generated_capacityreservationgroups_client.go @@ -0,0 +1,413 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// CapacityReservationGroupsClient contains the methods for the CapacityReservationGroups group. +// Don't use this type directly, use NewCapacityReservationGroupsClient() instead. +type CapacityReservationGroupsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewCapacityReservationGroupsClient creates a new instance of CapacityReservationGroupsClient with the specified values. +func NewCapacityReservationGroupsClient(con *arm.Connection, subscriptionID string) *CapacityReservationGroupsClient { + return &CapacityReservationGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// CreateOrUpdate - The operation to create or update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. +// Please refer to https://aka.ms/CapacityReservation for more +// details. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, parameters CapacityReservationGroup, options *CapacityReservationGroupsCreateOrUpdateOptions) (CapacityReservationGroupsCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, parameters, options) + if err != nil { + return CapacityReservationGroupsCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationGroupsCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return CapacityReservationGroupsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CapacityReservationGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, parameters CapacityReservationGroup, options *CapacityReservationGroupsCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + 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.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *CapacityReservationGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (CapacityReservationGroupsCreateOrUpdateResponse, error) { + result := CapacityReservationGroupsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil { + return CapacityReservationGroupsCreateOrUpdateResponse{}, err + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *CapacityReservationGroupsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - The operation to delete a capacity reservation group. This operation is allowed only if all the associated resources are disassociated from +// the reservation group and all capacity reservations under +// the reservation group have also been deleted. Please refer to https://aka.ms/CapacityReservation for more details. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationGroupsClient) Delete(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationGroupsDeleteOptions) (CapacityReservationGroupsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, options) + if err != nil { + return CapacityReservationGroupsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationGroupsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return CapacityReservationGroupsDeleteResponse{}, client.deleteHandleError(resp) + } + return CapacityReservationGroupsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CapacityReservationGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationGroupsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + 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.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *CapacityReservationGroupsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - The operation that retrieves information about a capacity reservation group. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationGroupsClient) Get(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationGroupsGetOptions) (CapacityReservationGroupsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, options) + if err != nil { + return CapacityReservationGroupsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationGroupsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CapacityReservationGroupsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CapacityReservationGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationGroupsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CapacityReservationGroupsClient) getHandleResponse(resp *http.Response) (CapacityReservationGroupsGetResponse, error) { + result := CapacityReservationGroupsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil { + return CapacityReservationGroupsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *CapacityReservationGroupsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - 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. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationGroupsClient) ListByResourceGroup(resourceGroupName string, options *CapacityReservationGroupsListByResourceGroupOptions) *CapacityReservationGroupsListByResourceGroupPager { + return &CapacityReservationGroupsListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp CapacityReservationGroupsListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.CapacityReservationGroupListResult.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *CapacityReservationGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CapacityReservationGroupsListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *CapacityReservationGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (CapacityReservationGroupsListByResourceGroupResponse, error) { + result := CapacityReservationGroupsListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroupListResult); err != nil { + return CapacityReservationGroupsListByResourceGroupResponse{}, err + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *CapacityReservationGroupsClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListBySubscription - 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. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationGroupsClient) ListBySubscription(options *CapacityReservationGroupsListBySubscriptionOptions) *CapacityReservationGroupsListBySubscriptionPager { + return &CapacityReservationGroupsListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp CapacityReservationGroupsListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.CapacityReservationGroupListResult.NextLink) + }, + } +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *CapacityReservationGroupsClient) listBySubscriptionCreateRequest(ctx context.Context, options *CapacityReservationGroupsListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/capacityReservationGroups" + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *CapacityReservationGroupsClient) listBySubscriptionHandleResponse(resp *http.Response) (CapacityReservationGroupsListBySubscriptionResponse, error) { + result := CapacityReservationGroupsListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroupListResult); err != nil { + return CapacityReservationGroupsListBySubscriptionResponse{}, err + } + return result, nil +} + +// listBySubscriptionHandleError handles the ListBySubscription error response. +func (client *CapacityReservationGroupsClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - The operation to update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationGroupsClient) Update(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, parameters CapacityReservationGroupUpdate, options *CapacityReservationGroupsUpdateOptions) (CapacityReservationGroupsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, parameters, options) + if err != nil { + return CapacityReservationGroupsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationGroupsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CapacityReservationGroupsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *CapacityReservationGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, parameters CapacityReservationGroupUpdate, options *CapacityReservationGroupsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + 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.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleResponse handles the Update response. +func (client *CapacityReservationGroupsClient) updateHandleResponse(resp *http.Response) (CapacityReservationGroupsUpdateResponse, error) { + result := CapacityReservationGroupsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil { + return CapacityReservationGroupsUpdateResponse{}, err + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *CapacityReservationGroupsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/compute/armcompute/zz_generated_capacityreservations_client.go b/sdk/compute/armcompute/zz_generated_capacityreservations_client.go new file mode 100644 index 000000000000..b58801ae5b6c --- /dev/null +++ b/sdk/compute/armcompute/zz_generated_capacityreservations_client.go @@ -0,0 +1,419 @@ +//go:build go1.16 +// +build go1.16 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armcompute + +import ( + "context" + "errors" + "fmt" + "net/http" + "net/url" + "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) + +// CapacityReservationsClient contains the methods for the CapacityReservations group. +// Don't use this type directly, use NewCapacityReservationsClient() instead. +type CapacityReservationsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewCapacityReservationsClient creates a new instance of CapacityReservationsClient with the specified values. +func NewCapacityReservationsClient(con *arm.Connection, subscriptionID string) *CapacityReservationsClient { + return &CapacityReservationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +} + +// BeginCreateOrUpdate - The operation to create or update a capacity reservation. Please note some properties can be set only during capacity reservation +// creation. Please refer to https://aka.ms/CapacityReservation for more +// details. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsBeginCreateOrUpdateOptions) (CapacityReservationsCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) + if err != nil { + return CapacityReservationsCreateOrUpdatePollerResponse{}, err + } + result := CapacityReservationsCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("CapacityReservationsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return CapacityReservationsCreateOrUpdatePollerResponse{}, err + } + result.Poller = &CapacityReservationsCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - The operation to create or update a capacity reservation. Please note some properties can be set only during capacity reservation creation. +// Please refer to https://aka.ms/CapacityReservation for more +// details. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CapacityReservationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservation, options *CapacityReservationsBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if capacityReservationName == "" { + return nil, errors.New("parameter capacityReservationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationName}", url.PathEscape(capacityReservationName)) + 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.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *CapacityReservationsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - The operation to delete a capacity reservation. This operation is allowed only when all the associated resources are disassociated from +// the capacity reservation. Please refer to +// https://aka.ms/CapacityReservation for more details. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationsClient) BeginDelete(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsBeginDeleteOptions) (CapacityReservationsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, options) + if err != nil { + return CapacityReservationsDeletePollerResponse{}, err + } + result := CapacityReservationsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("CapacityReservationsClient.Delete", "", resp, client.pl, client.deleteHandleError) + if err != nil { + return CapacityReservationsDeletePollerResponse{}, err + } + result.Poller = &CapacityReservationsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - The operation to delete a capacity reservation. This operation is allowed only when all the associated resources are disassociated from the +// capacity reservation. Please refer to +// https://aka.ms/CapacityReservation for more details. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationsClient) deleteOperation(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CapacityReservationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if capacityReservationName == "" { + return nil, errors.New("parameter capacityReservationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationName}", url.PathEscape(capacityReservationName)) + 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.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *CapacityReservationsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - The operation that retrieves information about the capacity reservation. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationsClient) Get(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsGetOptions) (CapacityReservationsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, options) + if err != nil { + return CapacityReservationsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CapacityReservationsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CapacityReservationsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CapacityReservationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, options *CapacityReservationsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if capacityReservationName == "" { + return nil, errors.New("parameter capacityReservationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationName}", url.PathEscape(capacityReservationName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Expand != nil { + reqQP.Set("$expand", string(*options.Expand)) + } + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CapacityReservationsClient) getHandleResponse(resp *http.Response) (CapacityReservationsGetResponse, error) { + result := CapacityReservationsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservation); err != nil { + return CapacityReservationsGetResponse{}, err + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *CapacityReservationsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByCapacityReservationGroup - 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. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationsClient) ListByCapacityReservationGroup(resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationsListByCapacityReservationGroupOptions) *CapacityReservationsListByCapacityReservationGroupPager { + return &CapacityReservationsListByCapacityReservationGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByCapacityReservationGroupCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, options) + }, + advancer: func(ctx context.Context, resp CapacityReservationsListByCapacityReservationGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.CapacityReservationListResult.NextLink) + }, + } +} + +// listByCapacityReservationGroupCreateRequest creates the ListByCapacityReservationGroup request. +func (client *CapacityReservationsClient) listByCapacityReservationGroupCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, options *CapacityReservationsListByCapacityReservationGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + 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.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByCapacityReservationGroupHandleResponse handles the ListByCapacityReservationGroup response. +func (client *CapacityReservationsClient) listByCapacityReservationGroupHandleResponse(resp *http.Response) (CapacityReservationsListByCapacityReservationGroupResponse, error) { + result := CapacityReservationsListByCapacityReservationGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationListResult); err != nil { + return CapacityReservationsListByCapacityReservationGroupResponse{}, err + } + return result, nil +} + +// listByCapacityReservationGroupHandleError handles the ListByCapacityReservationGroup error response. +func (client *CapacityReservationsClient) listByCapacityReservationGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginUpdate - The operation to update a capacity reservation. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsBeginUpdateOptions) (CapacityReservationsUpdatePollerResponse, error) { + resp, err := client.update(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) + if err != nil { + return CapacityReservationsUpdatePollerResponse{}, err + } + result := CapacityReservationsUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("CapacityReservationsClient.Update", "", resp, client.pl, client.updateHandleError) + if err != nil { + return CapacityReservationsUpdatePollerResponse{}, err + } + result.Poller = &CapacityReservationsUpdatePoller{ + pt: pt, + } + return result, nil +} + +// Update - The operation to update a capacity reservation. +// If the operation fails it returns the *CloudError error type. +func (client *CapacityReservationsClient) update(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsBeginUpdateOptions) (*http.Response, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, capacityReservationGroupName, capacityReservationName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.updateHandleError(resp) + } + return resp, nil +} + +// updateCreateRequest creates the Update request. +func (client *CapacityReservationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string, parameters CapacityReservationUpdate, options *CapacityReservationsBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}/capacityReservations/{capacityReservationName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if capacityReservationGroupName == "" { + return nil, errors.New("parameter capacityReservationGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationGroupName}", url.PathEscape(capacityReservationGroupName)) + if capacityReservationName == "" { + return nil, errors.New("parameter capacityReservationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{capacityReservationName}", url.PathEscape(capacityReservationName)) + 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.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// updateHandleError handles the Update error response. +func (client *CapacityReservationsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/compute/armcompute/zz_generated_cloudserviceoperatingsystems_client.go b/sdk/compute/armcompute/zz_generated_cloudserviceoperatingsystems_client.go index 4935644dbfee..8d95295f56e0 100644 --- a/sdk/compute/armcompute/zz_generated_cloudserviceoperatingsystems_client.go +++ b/sdk/compute/armcompute/zz_generated_cloudserviceoperatingsystems_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,44 +12,47 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // CloudServiceOperatingSystemsClient contains the methods for the CloudServiceOperatingSystems group. // Don't use this type directly, use NewCloudServiceOperatingSystemsClient() instead. type CloudServiceOperatingSystemsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewCloudServiceOperatingSystemsClient creates a new instance of CloudServiceOperatingSystemsClient with the specified values. -func NewCloudServiceOperatingSystemsClient(con *armcore.Connection, subscriptionID string) *CloudServiceOperatingSystemsClient { - return &CloudServiceOperatingSystemsClient{con: con, subscriptionID: subscriptionID} +func NewCloudServiceOperatingSystemsClient(con *arm.Connection, subscriptionID string) *CloudServiceOperatingSystemsClient { + return &CloudServiceOperatingSystemsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // GetOSFamily - Gets properties of a guest operating system family that can be specified in the XML service configuration (.cscfg) for a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceOperatingSystemsClient) GetOSFamily(ctx context.Context, location string, osFamilyName string, options *CloudServiceOperatingSystemsGetOSFamilyOptions) (OSFamilyResponse, error) { +func (client *CloudServiceOperatingSystemsClient) GetOSFamily(ctx context.Context, location string, osFamilyName string, options *CloudServiceOperatingSystemsGetOSFamilyOptions) (CloudServiceOperatingSystemsGetOSFamilyResponse, error) { req, err := client.getOSFamilyCreateRequest(ctx, location, osFamilyName, options) if err != nil { - return OSFamilyResponse{}, err + return CloudServiceOperatingSystemsGetOSFamilyResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return OSFamilyResponse{}, err + return CloudServiceOperatingSystemsGetOSFamilyResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return OSFamilyResponse{}, client.getOSFamilyHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceOperatingSystemsGetOSFamilyResponse{}, client.getOSFamilyHandleError(resp) } return client.getOSFamilyHandleResponse(resp) } // getOSFamilyCreateRequest creates the GetOSFamily request. -func (client *CloudServiceOperatingSystemsClient) getOSFamilyCreateRequest(ctx context.Context, location string, osFamilyName string, options *CloudServiceOperatingSystemsGetOSFamilyOptions) (*azcore.Request, error) { +func (client *CloudServiceOperatingSystemsClient) getOSFamilyCreateRequest(ctx context.Context, location string, osFamilyName string, options *CloudServiceOperatingSystemsGetOSFamilyOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies/{osFamilyName}" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -62,59 +66,58 @@ func (client *CloudServiceOperatingSystemsClient) getOSFamilyCreateRequest(ctx c return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getOSFamilyHandleResponse handles the GetOSFamily response. -func (client *CloudServiceOperatingSystemsClient) getOSFamilyHandleResponse(resp *azcore.Response) (OSFamilyResponse, error) { - var val *OSFamily - if err := resp.UnmarshalAsJSON(&val); err != nil { - return OSFamilyResponse{}, err +func (client *CloudServiceOperatingSystemsClient) getOSFamilyHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsGetOSFamilyResponse, error) { + result := CloudServiceOperatingSystemsGetOSFamilyResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OSFamily); err != nil { + return CloudServiceOperatingSystemsGetOSFamilyResponse{}, err } - return OSFamilyResponse{RawResponse: resp.Response, OSFamily: val}, nil + return result, nil } // getOSFamilyHandleError handles the GetOSFamily error response. -func (client *CloudServiceOperatingSystemsClient) getOSFamilyHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceOperatingSystemsClient) getOSFamilyHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // GetOSVersion - Gets properties of a guest operating system version that can be specified in the XML service configuration (.cscfg) for a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceOperatingSystemsClient) GetOSVersion(ctx context.Context, location string, osVersionName string, options *CloudServiceOperatingSystemsGetOSVersionOptions) (OSVersionResponse, error) { +func (client *CloudServiceOperatingSystemsClient) GetOSVersion(ctx context.Context, location string, osVersionName string, options *CloudServiceOperatingSystemsGetOSVersionOptions) (CloudServiceOperatingSystemsGetOSVersionResponse, error) { req, err := client.getOSVersionCreateRequest(ctx, location, osVersionName, options) if err != nil { - return OSVersionResponse{}, err + return CloudServiceOperatingSystemsGetOSVersionResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return OSVersionResponse{}, err + return CloudServiceOperatingSystemsGetOSVersionResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return OSVersionResponse{}, client.getOSVersionHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceOperatingSystemsGetOSVersionResponse{}, client.getOSVersionHandleError(resp) } return client.getOSVersionHandleResponse(resp) } // getOSVersionCreateRequest creates the GetOSVersion request. -func (client *CloudServiceOperatingSystemsClient) getOSVersionCreateRequest(ctx context.Context, location string, osVersionName string, options *CloudServiceOperatingSystemsGetOSVersionOptions) (*azcore.Request, error) { +func (client *CloudServiceOperatingSystemsClient) getOSVersionCreateRequest(ctx context.Context, location string, osVersionName string, options *CloudServiceOperatingSystemsGetOSVersionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions/{osVersionName}" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -128,61 +131,57 @@ func (client *CloudServiceOperatingSystemsClient) getOSVersionCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getOSVersionHandleResponse handles the GetOSVersion response. -func (client *CloudServiceOperatingSystemsClient) getOSVersionHandleResponse(resp *azcore.Response) (OSVersionResponse, error) { - var val *OSVersion - if err := resp.UnmarshalAsJSON(&val); err != nil { - return OSVersionResponse{}, err +func (client *CloudServiceOperatingSystemsClient) getOSVersionHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsGetOSVersionResponse, error) { + result := CloudServiceOperatingSystemsGetOSVersionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OSVersion); err != nil { + return CloudServiceOperatingSystemsGetOSVersionResponse{}, err } - return OSVersionResponse{RawResponse: resp.Response, OSVersion: val}, nil + return result, nil } // getOSVersionHandleError handles the GetOSVersion error response. -func (client *CloudServiceOperatingSystemsClient) getOSVersionHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceOperatingSystemsClient) getOSVersionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListOSFamilies - Gets a list of all guest operating system families available to be specified in the XML service configuration (.cscfg) for a cloud service. // Use nextLink property in the response to get the next page // of OS Families. Do this till nextLink is null to fetch all the OS Families. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceOperatingSystemsClient) ListOSFamilies(location string, options *CloudServiceOperatingSystemsListOSFamiliesOptions) OSFamilyListResultPager { - return &osFamilyListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *CloudServiceOperatingSystemsClient) ListOSFamilies(location string, options *CloudServiceOperatingSystemsListOSFamiliesOptions) *CloudServiceOperatingSystemsListOSFamiliesPager { + return &CloudServiceOperatingSystemsListOSFamiliesPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listOSFamiliesCreateRequest(ctx, location, options) }, - responder: client.listOSFamiliesHandleResponse, - errorer: client.listOSFamiliesHandleError, - advancer: func(ctx context.Context, resp OSFamilyListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.OSFamilyListResult.NextLink) + advancer: func(ctx context.Context, resp CloudServiceOperatingSystemsListOSFamiliesResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.OSFamilyListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listOSFamiliesCreateRequest creates the ListOSFamilies request. -func (client *CloudServiceOperatingSystemsClient) listOSFamiliesCreateRequest(ctx context.Context, location string, options *CloudServiceOperatingSystemsListOSFamiliesOptions) (*azcore.Request, error) { +func (client *CloudServiceOperatingSystemsClient) listOSFamiliesCreateRequest(ctx context.Context, location string, options *CloudServiceOperatingSystemsListOSFamiliesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsFamilies" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -192,61 +191,57 @@ func (client *CloudServiceOperatingSystemsClient) listOSFamiliesCreateRequest(ct return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listOSFamiliesHandleResponse handles the ListOSFamilies response. -func (client *CloudServiceOperatingSystemsClient) listOSFamiliesHandleResponse(resp *azcore.Response) (OSFamilyListResultResponse, error) { - var val *OSFamilyListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return OSFamilyListResultResponse{}, err +func (client *CloudServiceOperatingSystemsClient) listOSFamiliesHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsListOSFamiliesResponse, error) { + result := CloudServiceOperatingSystemsListOSFamiliesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OSFamilyListResult); err != nil { + return CloudServiceOperatingSystemsListOSFamiliesResponse{}, err } - return OSFamilyListResultResponse{RawResponse: resp.Response, OSFamilyListResult: val}, nil + return result, nil } // listOSFamiliesHandleError handles the ListOSFamilies error response. -func (client *CloudServiceOperatingSystemsClient) listOSFamiliesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceOperatingSystemsClient) listOSFamiliesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListOSVersions - Gets a list of all guest operating system versions available to be specified in the XML service configuration (.cscfg) for a cloud service. // Use nextLink property in the response to get the next page // of OS versions. Do this till nextLink is null to fetch all the OS versions. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceOperatingSystemsClient) ListOSVersions(location string, options *CloudServiceOperatingSystemsListOSVersionsOptions) OSVersionListResultPager { - return &osVersionListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *CloudServiceOperatingSystemsClient) ListOSVersions(location string, options *CloudServiceOperatingSystemsListOSVersionsOptions) *CloudServiceOperatingSystemsListOSVersionsPager { + return &CloudServiceOperatingSystemsListOSVersionsPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listOSVersionsCreateRequest(ctx, location, options) }, - responder: client.listOSVersionsHandleResponse, - errorer: client.listOSVersionsHandleError, - advancer: func(ctx context.Context, resp OSVersionListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.OSVersionListResult.NextLink) + advancer: func(ctx context.Context, resp CloudServiceOperatingSystemsListOSVersionsResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.OSVersionListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listOSVersionsCreateRequest creates the ListOSVersions request. -func (client *CloudServiceOperatingSystemsClient) listOSVersionsCreateRequest(ctx context.Context, location string, options *CloudServiceOperatingSystemsListOSVersionsOptions) (*azcore.Request, error) { +func (client *CloudServiceOperatingSystemsClient) listOSVersionsCreateRequest(ctx context.Context, location string, options *CloudServiceOperatingSystemsListOSVersionsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/cloudServiceOsVersions" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -256,36 +251,35 @@ func (client *CloudServiceOperatingSystemsClient) listOSVersionsCreateRequest(ct return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listOSVersionsHandleResponse handles the ListOSVersions response. -func (client *CloudServiceOperatingSystemsClient) listOSVersionsHandleResponse(resp *azcore.Response) (OSVersionListResultResponse, error) { - var val *OSVersionListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return OSVersionListResultResponse{}, err +func (client *CloudServiceOperatingSystemsClient) listOSVersionsHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsListOSVersionsResponse, error) { + result := CloudServiceOperatingSystemsListOSVersionsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OSVersionListResult); err != nil { + return CloudServiceOperatingSystemsListOSVersionsResponse{}, err } - return OSVersionListResultResponse{RawResponse: resp.Response, OSVersionListResult: val}, nil + return result, nil } // listOSVersionsHandleError handles the ListOSVersions error response. -func (client *CloudServiceOperatingSystemsClient) listOSVersionsHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceOperatingSystemsClient) listOSVersionsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_cloudserviceroleinstances_client.go b/sdk/compute/armcompute/zz_generated_cloudserviceroleinstances_client.go index af73bb83ebe6..9329d12553cb 100644 --- a/sdk/compute/armcompute/zz_generated_cloudserviceroleinstances_client.go +++ b/sdk/compute/armcompute/zz_generated_cloudserviceroleinstances_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // CloudServiceRoleInstancesClient contains the methods for the CloudServiceRoleInstances group. // Don't use this type directly, use NewCloudServiceRoleInstancesClient() instead. type CloudServiceRoleInstancesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewCloudServiceRoleInstancesClient creates a new instance of CloudServiceRoleInstancesClient with the specified values. -func NewCloudServiceRoleInstancesClient(con *armcore.Connection, subscriptionID string) *CloudServiceRoleInstancesClient { - return &CloudServiceRoleInstancesClient{con: con, subscriptionID: subscriptionID} +func NewCloudServiceRoleInstancesClient(con *arm.Connection, subscriptionID string) *CloudServiceRoleInstancesClient { + return &CloudServiceRoleInstancesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginDelete - Deletes a role instance from a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) BeginDelete(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *CloudServiceRoleInstancesClient) BeginDelete(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginDeleteOptions) (CloudServiceRoleInstancesDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("CloudServiceRoleInstancesClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return CloudServiceRoleInstancesDeletePollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := CloudServiceRoleInstancesDeletePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServiceRoleInstancesClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServiceRoleInstancesClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("CloudServiceRoleInstancesClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServiceRoleInstancesDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServiceRoleInstancesDeletePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Deletes a role instance from a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) deleteOperation(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginDeleteOptions) (*azcore.Response, error) { +func (client *CloudServiceRoleInstancesClient) deleteOperation(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *CloudServiceRoleInstancesClient) deleteCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginDeleteOptions) (*azcore.Request, error) { +func (client *CloudServiceRoleInstancesClient) deleteCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}" if roleInstanceName == "" { return nil, errors.New("parameter roleInstanceName cannot be empty") @@ -115,50 +91,49 @@ func (client *CloudServiceRoleInstancesClient) deleteCreateRequest(ctx context.C return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *CloudServiceRoleInstancesClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceRoleInstancesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - Gets a role instance from a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) Get(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetOptions) (RoleInstanceResponse, error) { +func (client *CloudServiceRoleInstancesClient) Get(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetOptions) (CloudServiceRoleInstancesGetResponse, error) { req, err := client.getCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { - return RoleInstanceResponse{}, err + return CloudServiceRoleInstancesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RoleInstanceResponse{}, err + return CloudServiceRoleInstancesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return RoleInstanceResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceRoleInstancesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *CloudServiceRoleInstancesClient) getCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetOptions) (*azcore.Request, error) { +func (client *CloudServiceRoleInstancesClient) getCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}" if roleInstanceName == "" { return nil, errors.New("parameter roleInstanceName cannot be empty") @@ -176,62 +151,61 @@ func (client *CloudServiceRoleInstancesClient) getCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *CloudServiceRoleInstancesClient) getHandleResponse(resp *azcore.Response) (RoleInstanceResponse, error) { - var val *RoleInstance - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RoleInstanceResponse{}, err +func (client *CloudServiceRoleInstancesClient) getHandleResponse(resp *http.Response) (CloudServiceRoleInstancesGetResponse, error) { + result := CloudServiceRoleInstancesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleInstance); err != nil { + return CloudServiceRoleInstancesGetResponse{}, err } - return RoleInstanceResponse{RawResponse: resp.Response, RoleInstance: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *CloudServiceRoleInstancesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceRoleInstancesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // GetInstanceView - Retrieves information about the run-time state of a role instance in a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) GetInstanceView(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetInstanceViewOptions) (RoleInstanceViewResponse, error) { +func (client *CloudServiceRoleInstancesClient) GetInstanceView(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetInstanceViewOptions) (CloudServiceRoleInstancesGetInstanceViewResponse, error) { req, err := client.getInstanceViewCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { - return RoleInstanceViewResponse{}, err + return CloudServiceRoleInstancesGetInstanceViewResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RoleInstanceViewResponse{}, err + return CloudServiceRoleInstancesGetInstanceViewResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return RoleInstanceViewResponse{}, client.getInstanceViewHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceRoleInstancesGetInstanceViewResponse{}, client.getInstanceViewHandleError(resp) } return client.getInstanceViewHandleResponse(resp) } // getInstanceViewCreateRequest creates the GetInstanceView request. -func (client *CloudServiceRoleInstancesClient) getInstanceViewCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetInstanceViewOptions) (*azcore.Request, error) { +func (client *CloudServiceRoleInstancesClient) getInstanceViewCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetInstanceViewOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/instanceView" if roleInstanceName == "" { return nil, errors.New("parameter roleInstanceName cannot be empty") @@ -249,59 +223,58 @@ func (client *CloudServiceRoleInstancesClient) getInstanceViewCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getInstanceViewHandleResponse handles the GetInstanceView response. -func (client *CloudServiceRoleInstancesClient) getInstanceViewHandleResponse(resp *azcore.Response) (RoleInstanceViewResponse, error) { - var val *RoleInstanceView - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RoleInstanceViewResponse{}, err +func (client *CloudServiceRoleInstancesClient) getInstanceViewHandleResponse(resp *http.Response) (CloudServiceRoleInstancesGetInstanceViewResponse, error) { + result := CloudServiceRoleInstancesGetInstanceViewResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleInstanceView); err != nil { + return CloudServiceRoleInstancesGetInstanceViewResponse{}, err } - return RoleInstanceViewResponse{RawResponse: resp.Response, RoleInstanceView: val}, nil + return result, nil } // getInstanceViewHandleError handles the GetInstanceView error response. -func (client *CloudServiceRoleInstancesClient) getInstanceViewHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceRoleInstancesClient) getInstanceViewHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // GetRemoteDesktopFile - Gets a remote desktop file for a role instance in a cloud service. // If the operation fails it returns a generic error. -func (client *CloudServiceRoleInstancesClient) GetRemoteDesktopFile(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetRemoteDesktopFileOptions) (*http.Response, error) { +func (client *CloudServiceRoleInstancesClient) GetRemoteDesktopFile(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetRemoteDesktopFileOptions) (CloudServiceRoleInstancesGetRemoteDesktopFileResponse, error) { req, err := client.getRemoteDesktopFileCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { - return nil, err + return CloudServiceRoleInstancesGetRemoteDesktopFileResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return nil, err + return CloudServiceRoleInstancesGetRemoteDesktopFileResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return nil, client.getRemoteDesktopFileHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceRoleInstancesGetRemoteDesktopFileResponse{}, client.getRemoteDesktopFileHandleError(resp) } - return resp.Response, nil + return CloudServiceRoleInstancesGetRemoteDesktopFileResponse{RawResponse: resp}, nil } // getRemoteDesktopFileCreateRequest creates the GetRemoteDesktopFile request. -func (client *CloudServiceRoleInstancesClient) getRemoteDesktopFileCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetRemoteDesktopFileOptions) (*azcore.Request, error) { +func (client *CloudServiceRoleInstancesClient) getRemoteDesktopFileCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesGetRemoteDesktopFileOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/remoteDesktopFile" if roleInstanceName == "" { return nil, errors.New("parameter roleInstanceName cannot be empty") @@ -319,51 +292,47 @@ func (client *CloudServiceRoleInstancesClient) getRemoteDesktopFileCreateRequest return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = reqQP.Encode() req.SkipBodyDownload() - req.Header.Set("Accept", "application/x-rdp") + req.Raw().Header.Set("Accept", "application/x-rdp") return req, nil } // getRemoteDesktopFileHandleError handles the GetRemoteDesktopFile error response. -func (client *CloudServiceRoleInstancesClient) getRemoteDesktopFileHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceRoleInstancesClient) getRemoteDesktopFileHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - Gets the list of all role instances in a cloud service. Use nextLink property in the response to get the next page of role instances. Do this // till nextLink is null to fetch all the role instances. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) List(resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesListOptions) RoleInstanceListResultPager { - return &roleInstanceListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *CloudServiceRoleInstancesClient) List(resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesListOptions) *CloudServiceRoleInstancesListPager { + return &CloudServiceRoleInstancesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, resourceGroupName, cloudServiceName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp RoleInstanceListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.RoleInstanceListResult.NextLink) + advancer: func(ctx context.Context, resp CloudServiceRoleInstancesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.RoleInstanceListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *CloudServiceRoleInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesListOptions) (*azcore.Request, error) { +func (client *CloudServiceRoleInstancesClient) listCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -377,90 +346,61 @@ func (client *CloudServiceRoleInstancesClient) listCreateRequest(ctx context.Con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *CloudServiceRoleInstancesClient) listHandleResponse(resp *azcore.Response) (RoleInstanceListResultResponse, error) { - var val *RoleInstanceListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RoleInstanceListResultResponse{}, err +func (client *CloudServiceRoleInstancesClient) listHandleResponse(resp *http.Response) (CloudServiceRoleInstancesListResponse, error) { + result := CloudServiceRoleInstancesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RoleInstanceListResult); err != nil { + return CloudServiceRoleInstancesListResponse{}, err } - return RoleInstanceListResultResponse{RawResponse: resp.Response, RoleInstanceListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *CloudServiceRoleInstancesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceRoleInstancesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginRebuild - The Rebuild Role Instance asynchronous operation reinstalls the operating system on instances of web roles or worker roles and initializes // the storage resources that are used by them. If you do not // want to initialize storage resources, you can use Reimage Role Instance. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) BeginRebuild(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRebuildOptions) (HTTPPollerResponse, error) { +func (client *CloudServiceRoleInstancesClient) BeginRebuild(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRebuildOptions) (CloudServiceRoleInstancesRebuildPollerResponse, error) { resp, err := client.rebuild(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err + return CloudServiceRoleInstancesRebuildPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("CloudServiceRoleInstancesClient.Rebuild", "", resp, client.con.Pipeline(), client.rebuildHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := CloudServiceRoleInstancesRebuildPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeRebuild creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServiceRoleInstancesClient) ResumeRebuild(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServiceRoleInstancesClient.Rebuild", token, client.con.Pipeline(), client.rebuildHandleError) + pt, err := armruntime.NewPoller("CloudServiceRoleInstancesClient.Rebuild", "", resp, client.pl, client.rebuildHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServiceRoleInstancesRebuildPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServiceRoleInstancesRebuildPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } @@ -468,23 +408,23 @@ func (client *CloudServiceRoleInstancesClient) ResumeRebuild(ctx context.Context // the storage resources that are used by them. If you do not // want to initialize storage resources, you can use Reimage Role Instance. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) rebuild(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRebuildOptions) (*azcore.Response, error) { +func (client *CloudServiceRoleInstancesClient) rebuild(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRebuildOptions) (*http.Response, error) { req, err := client.rebuildCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.rebuildHandleError(resp) } return resp, nil } // rebuildCreateRequest creates the Rebuild request. -func (client *CloudServiceRoleInstancesClient) rebuildCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRebuildOptions) (*azcore.Request, error) { +func (client *CloudServiceRoleInstancesClient) rebuildCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRebuildOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/rebuild" if roleInstanceName == "" { return nil, errors.New("parameter roleInstanceName cannot be empty") @@ -502,98 +442,69 @@ func (client *CloudServiceRoleInstancesClient) rebuildCreateRequest(ctx context. return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // rebuildHandleError handles the Rebuild error response. -func (client *CloudServiceRoleInstancesClient) rebuildHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceRoleInstancesClient) rebuildHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginReimage - The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or worker roles. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) BeginReimage(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginReimageOptions) (HTTPPollerResponse, error) { +func (client *CloudServiceRoleInstancesClient) BeginReimage(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginReimageOptions) (CloudServiceRoleInstancesReimagePollerResponse, error) { resp, err := client.reimage(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err + return CloudServiceRoleInstancesReimagePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := CloudServiceRoleInstancesReimagePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("CloudServiceRoleInstancesClient.Reimage", "", resp, client.con.Pipeline(), client.reimageHandleError) + pt, err := armruntime.NewPoller("CloudServiceRoleInstancesClient.Reimage", "", resp, client.pl, client.reimageHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServiceRoleInstancesReimagePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServiceRoleInstancesReimagePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeReimage creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServiceRoleInstancesClient) ResumeReimage(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServiceRoleInstancesClient.Reimage", token, client.con.Pipeline(), client.reimageHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Reimage - The Reimage Role Instance asynchronous operation reinstalls the operating system on instances of web roles or worker roles. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) reimage(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginReimageOptions) (*azcore.Response, error) { +func (client *CloudServiceRoleInstancesClient) reimage(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.reimageHandleError(resp) } return resp, nil } // reimageCreateRequest creates the Reimage request. -func (client *CloudServiceRoleInstancesClient) reimageCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginReimageOptions) (*azcore.Request, error) { +func (client *CloudServiceRoleInstancesClient) reimageCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginReimageOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/reimage" if roleInstanceName == "" { return nil, errors.New("parameter roleInstanceName cannot be empty") @@ -611,98 +522,69 @@ func (client *CloudServiceRoleInstancesClient) reimageCreateRequest(ctx context. return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // reimageHandleError handles the Reimage error response. -func (client *CloudServiceRoleInstancesClient) reimageHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceRoleInstancesClient) reimageHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginRestart - The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) BeginRestart(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRestartOptions) (HTTPPollerResponse, error) { +func (client *CloudServiceRoleInstancesClient) BeginRestart(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRestartOptions) (CloudServiceRoleInstancesRestartPollerResponse, error) { resp, err := client.restart(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err + return CloudServiceRoleInstancesRestartPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := CloudServiceRoleInstancesRestartPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("CloudServiceRoleInstancesClient.Restart", "", resp, client.con.Pipeline(), client.restartHandleError) + pt, err := armruntime.NewPoller("CloudServiceRoleInstancesClient.Restart", "", resp, client.pl, client.restartHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServiceRoleInstancesRestartPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServiceRoleInstancesRestartPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeRestart creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServiceRoleInstancesClient) ResumeRestart(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServiceRoleInstancesClient.Restart", token, client.con.Pipeline(), client.restartHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Restart - The Reboot Role Instance asynchronous operation requests a reboot of a role instance in the cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRoleInstancesClient) restart(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRestartOptions) (*azcore.Response, error) { +func (client *CloudServiceRoleInstancesClient) restart(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, roleInstanceName, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.restartHandleError(resp) } return resp, nil } // restartCreateRequest creates the Restart request. -func (client *CloudServiceRoleInstancesClient) restartCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRestartOptions) (*azcore.Request, error) { +func (client *CloudServiceRoleInstancesClient) restartCreateRequest(ctx context.Context, roleInstanceName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRoleInstancesBeginRestartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/restart" if roleInstanceName == "" { return nil, errors.New("parameter roleInstanceName cannot be empty") @@ -720,27 +602,26 @@ func (client *CloudServiceRoleInstancesClient) restartCreateRequest(ctx context. return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // restartHandleError handles the Restart error response. -func (client *CloudServiceRoleInstancesClient) restartHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceRoleInstancesClient) restartHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_cloudserviceroles_client.go b/sdk/compute/armcompute/zz_generated_cloudserviceroles_client.go index f5645330d4d2..aab3e6be5368 100644 --- a/sdk/compute/armcompute/zz_generated_cloudserviceroles_client.go +++ b/sdk/compute/armcompute/zz_generated_cloudserviceroles_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,44 +12,47 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // CloudServiceRolesClient contains the methods for the CloudServiceRoles group. // Don't use this type directly, use NewCloudServiceRolesClient() instead. type CloudServiceRolesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewCloudServiceRolesClient creates a new instance of CloudServiceRolesClient with the specified values. -func NewCloudServiceRolesClient(con *armcore.Connection, subscriptionID string) *CloudServiceRolesClient { - return &CloudServiceRolesClient{con: con, subscriptionID: subscriptionID} +func NewCloudServiceRolesClient(con *arm.Connection, subscriptionID string) *CloudServiceRolesClient { + return &CloudServiceRolesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // Get - Gets a role from a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRolesClient) Get(ctx context.Context, roleName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRolesGetOptions) (CloudServiceRoleResponse, error) { +func (client *CloudServiceRolesClient) Get(ctx context.Context, roleName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRolesGetOptions) (CloudServiceRolesGetResponse, error) { req, err := client.getCreateRequest(ctx, roleName, resourceGroupName, cloudServiceName, options) if err != nil { - return CloudServiceRoleResponse{}, err + return CloudServiceRolesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return CloudServiceRoleResponse{}, err + return CloudServiceRolesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return CloudServiceRoleResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServiceRolesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *CloudServiceRolesClient) getCreateRequest(ctx context.Context, roleName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRolesGetOptions) (*azcore.Request, error) { +func (client *CloudServiceRolesClient) getCreateRequest(ctx context.Context, roleName string, resourceGroupName string, cloudServiceName string, options *CloudServiceRolesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles/{roleName}" if roleName == "" { return nil, errors.New("parameter roleName cannot be empty") @@ -66,60 +70,56 @@ func (client *CloudServiceRolesClient) getCreateRequest(ctx context.Context, rol return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *CloudServiceRolesClient) getHandleResponse(resp *azcore.Response) (CloudServiceRoleResponse, error) { - var val *CloudServiceRole - if err := resp.UnmarshalAsJSON(&val); err != nil { - return CloudServiceRoleResponse{}, err +func (client *CloudServiceRolesClient) getHandleResponse(resp *http.Response) (CloudServiceRolesGetResponse, error) { + result := CloudServiceRolesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceRole); err != nil { + return CloudServiceRolesGetResponse{}, err } - return CloudServiceRoleResponse{RawResponse: resp.Response, CloudServiceRole: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *CloudServiceRolesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceRolesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - Gets a list of all roles in a cloud service. Use nextLink property in the response to get the next page of roles. Do this till nextLink is null // to fetch all the roles. // If the operation fails it returns the *CloudError error type. -func (client *CloudServiceRolesClient) List(resourceGroupName string, cloudServiceName string, options *CloudServiceRolesListOptions) CloudServiceRoleListResultPager { - return &cloudServiceRoleListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *CloudServiceRolesClient) List(resourceGroupName string, cloudServiceName string, options *CloudServiceRolesListOptions) *CloudServiceRolesListPager { + return &CloudServiceRolesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, resourceGroupName, cloudServiceName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp CloudServiceRoleListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.CloudServiceRoleListResult.NextLink) + advancer: func(ctx context.Context, resp CloudServiceRolesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.CloudServiceRoleListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *CloudServiceRolesClient) listCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServiceRolesListOptions) (*azcore.Request, error) { +func (client *CloudServiceRolesClient) listCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServiceRolesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roles" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -133,36 +133,35 @@ func (client *CloudServiceRolesClient) listCreateRequest(ctx context.Context, re return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *CloudServiceRolesClient) listHandleResponse(resp *azcore.Response) (CloudServiceRoleListResultResponse, error) { - var val *CloudServiceRoleListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return CloudServiceRoleListResultResponse{}, err +func (client *CloudServiceRolesClient) listHandleResponse(resp *http.Response) (CloudServiceRolesListResponse, error) { + result := CloudServiceRolesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceRoleListResult); err != nil { + return CloudServiceRolesListResponse{}, err } - return CloudServiceRoleListResultResponse{RawResponse: resp.Response, CloudServiceRoleListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *CloudServiceRolesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServiceRolesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_cloudservices_client.go b/sdk/compute/armcompute/zz_generated_cloudservices_client.go index 6e7899a5b7b5..626c37c853c0 100644 --- a/sdk/compute/armcompute/zz_generated_cloudservices_client.go +++ b/sdk/compute/armcompute/zz_generated_cloudservices_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // CloudServicesClient contains the methods for the CloudServices group. // Don't use this type directly, use NewCloudServicesClient() instead. type CloudServicesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewCloudServicesClient creates a new instance of CloudServicesClient with the specified values. -func NewCloudServicesClient(con *armcore.Connection, subscriptionID string) *CloudServicesClient { - return &CloudServicesClient{con: con, subscriptionID: subscriptionID} +func NewCloudServicesClient(con *arm.Connection, subscriptionID string) *CloudServicesClient { + return &CloudServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Create or update a cloud service. Please note some properties can be set only during cloud service creation. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginCreateOrUpdateOptions) (CloudServicePollerResponse, error) { +func (client *CloudServicesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginCreateOrUpdateOptions) (CloudServicesCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return CloudServicePollerResponse{}, err + return CloudServicesCreateOrUpdatePollerResponse{}, err } - result := CloudServicePollerResponse{ - RawResponse: resp.Response, + result := CloudServicesCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("CloudServicesClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("CloudServicesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return CloudServicePollerResponse{}, err + return CloudServicesCreateOrUpdatePollerResponse{}, err } - poller := &cloudServicePoller{ + result.Poller = &CloudServicesCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (CloudServiceResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new CloudServicePoller from the specified resume token. -// token - The value must come from a previous call to CloudServicePoller.ResumeToken(). -func (client *CloudServicesClient) ResumeCreateOrUpdate(ctx context.Context, token string) (CloudServicePollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServicesClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return CloudServicePollerResponse{}, err - } - poller := &cloudServicePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return CloudServicePollerResponse{}, err - } - result := CloudServicePollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (CloudServiceResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Create or update a cloud service. Please note some properties can be set only during cloud service creation. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *CloudServicesClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CloudServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -111,101 +87,72 @@ func (client *CloudServicesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { - return req, req.MarshalAsJSON(*options.Parameters) + return req, runtime.MarshalAsJSON(req, *options.Parameters) } return req, nil } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *CloudServicesClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - Deletes a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *CloudServicesClient) BeginDelete(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteOptions) (CloudServicesDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("CloudServicesClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := CloudServicesDeletePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServicesClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServicesClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("CloudServicesClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServicesDeletePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Deletes a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteOptions) (*azcore.Response, error) { +func (client *CloudServicesClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *CloudServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -219,98 +166,69 @@ func (client *CloudServicesClient) deleteCreateRequest(ctx context.Context, reso return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *CloudServicesClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDeleteInstances - Deletes role instances in a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) BeginDeleteInstances(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteInstancesOptions) (HTTPPollerResponse, error) { +func (client *CloudServicesClient) BeginDeleteInstances(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteInstancesOptions) (CloudServicesDeleteInstancesPollerResponse, error) { resp, err := client.deleteInstances(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("CloudServicesClient.DeleteInstances", "", resp, client.con.Pipeline(), client.deleteInstancesHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return CloudServicesDeleteInstancesPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := CloudServicesDeleteInstancesPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDeleteInstances creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServicesClient) ResumeDeleteInstances(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServicesClient.DeleteInstances", token, client.con.Pipeline(), client.deleteInstancesHandleError) + pt, err := armruntime.NewPoller("CloudServicesClient.DeleteInstances", "", resp, client.pl, client.deleteInstancesHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesDeleteInstancesPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServicesDeleteInstancesPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // DeleteInstances - Deletes role instances in a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) deleteInstances(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteInstancesOptions) (*azcore.Response, error) { +func (client *CloudServicesClient) deleteInstances(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteInstancesOptions) (*http.Response, error) { req, err := client.deleteInstancesCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.deleteInstancesHandleError(resp) } return resp, nil } // deleteInstancesCreateRequest creates the DeleteInstances request. -func (client *CloudServicesClient) deleteInstancesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteInstancesOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) deleteInstancesCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginDeleteInstancesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/delete" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -324,53 +242,52 @@ func (client *CloudServicesClient) deleteInstancesCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { - return req, req.MarshalAsJSON(*options.Parameters) + return req, runtime.MarshalAsJSON(req, *options.Parameters) } return req, nil } // deleteInstancesHandleError handles the DeleteInstances error response. -func (client *CloudServicesClient) deleteInstancesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) deleteInstancesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - Display information about a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) Get(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesGetOptions) (CloudServiceResponse, error) { +func (client *CloudServicesClient) Get(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesGetOptions) (CloudServicesGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return CloudServiceResponse{}, err + return CloudServicesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return CloudServiceResponse{}, err + return CloudServicesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return CloudServiceResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServicesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *CloudServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesGetOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -384,59 +301,58 @@ func (client *CloudServicesClient) getCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *CloudServicesClient) getHandleResponse(resp *azcore.Response) (CloudServiceResponse, error) { - var val *CloudService - if err := resp.UnmarshalAsJSON(&val); err != nil { - return CloudServiceResponse{}, err +func (client *CloudServicesClient) getHandleResponse(resp *http.Response) (CloudServicesGetResponse, error) { + result := CloudServicesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudService); err != nil { + return CloudServicesGetResponse{}, err } - return CloudServiceResponse{RawResponse: resp.Response, CloudService: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *CloudServicesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // GetInstanceView - Gets the status of a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) GetInstanceView(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesGetInstanceViewOptions) (CloudServiceInstanceViewResponse, error) { +func (client *CloudServicesClient) GetInstanceView(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesGetInstanceViewOptions) (CloudServicesGetInstanceViewResponse, error) { req, err := client.getInstanceViewCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return CloudServiceInstanceViewResponse{}, err + return CloudServicesGetInstanceViewResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return CloudServiceInstanceViewResponse{}, err + return CloudServicesGetInstanceViewResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return CloudServiceInstanceViewResponse{}, client.getInstanceViewHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServicesGetInstanceViewResponse{}, client.getInstanceViewHandleError(resp) } return client.getInstanceViewHandleResponse(resp) } // getInstanceViewCreateRequest creates the GetInstanceView request. -func (client *CloudServicesClient) getInstanceViewCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesGetInstanceViewOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) getInstanceViewCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesGetInstanceViewOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/instanceView" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -450,60 +366,56 @@ func (client *CloudServicesClient) getInstanceViewCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getInstanceViewHandleResponse handles the GetInstanceView response. -func (client *CloudServicesClient) getInstanceViewHandleResponse(resp *azcore.Response) (CloudServiceInstanceViewResponse, error) { - var val *CloudServiceInstanceView - if err := resp.UnmarshalAsJSON(&val); err != nil { - return CloudServiceInstanceViewResponse{}, err +func (client *CloudServicesClient) getInstanceViewHandleResponse(resp *http.Response) (CloudServicesGetInstanceViewResponse, error) { + result := CloudServicesGetInstanceViewResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceInstanceView); err != nil { + return CloudServicesGetInstanceViewResponse{}, err } - return CloudServiceInstanceViewResponse{RawResponse: resp.Response, CloudServiceInstanceView: val}, nil + return result, nil } // getInstanceViewHandleError handles the GetInstanceView error response. -func (client *CloudServicesClient) getInstanceViewHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) getInstanceViewHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - Gets a list of all cloud services under a resource group. Use nextLink property in the response to get the next page of Cloud Services. Do this // till nextLink is null to fetch all the Cloud Services. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) List(resourceGroupName string, options *CloudServicesListOptions) CloudServiceListResultPager { - return &cloudServiceListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *CloudServicesClient) List(resourceGroupName string, options *CloudServicesListOptions) *CloudServicesListPager { + return &CloudServicesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp CloudServiceListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.CloudServiceListResult.NextLink) + advancer: func(ctx context.Context, resp CloudServicesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.CloudServiceListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *CloudServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *CloudServicesListOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *CloudServicesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -513,167 +425,134 @@ func (client *CloudServicesClient) listCreateRequest(ctx context.Context, resour return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *CloudServicesClient) listHandleResponse(resp *azcore.Response) (CloudServiceListResultResponse, error) { - var val *CloudServiceListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return CloudServiceListResultResponse{}, err +func (client *CloudServicesClient) listHandleResponse(resp *http.Response) (CloudServicesListResponse, error) { + result := CloudServicesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceListResult); err != nil { + return CloudServicesListResponse{}, err } - return CloudServiceListResultResponse{RawResponse: resp.Response, CloudServiceListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *CloudServicesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListAll - Gets a list of all cloud services in the subscription, regardless of the associated resource group. Use nextLink property in the response to // get the next page of Cloud Services. Do this till nextLink // is null to fetch all the Cloud Services. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) ListAll(options *CloudServicesListAllOptions) CloudServiceListResultPager { - return &cloudServiceListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *CloudServicesClient) ListAll(options *CloudServicesListAllOptions) *CloudServicesListAllPager { + return &CloudServicesListAllPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listAllCreateRequest(ctx, options) }, - responder: client.listAllHandleResponse, - errorer: client.listAllHandleError, - advancer: func(ctx context.Context, resp CloudServiceListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.CloudServiceListResult.NextLink) + advancer: func(ctx context.Context, resp CloudServicesListAllResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.CloudServiceListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listAllCreateRequest creates the ListAll request. -func (client *CloudServicesClient) listAllCreateRequest(ctx context.Context, options *CloudServicesListAllOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) listAllCreateRequest(ctx context.Context, options *CloudServicesListAllOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/cloudServices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listAllHandleResponse handles the ListAll response. -func (client *CloudServicesClient) listAllHandleResponse(resp *azcore.Response) (CloudServiceListResultResponse, error) { - var val *CloudServiceListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return CloudServiceListResultResponse{}, err +func (client *CloudServicesClient) listAllHandleResponse(resp *http.Response) (CloudServicesListAllResponse, error) { + result := CloudServicesListAllResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceListResult); err != nil { + return CloudServicesListAllResponse{}, err } - return CloudServiceListResultResponse{RawResponse: resp.Response, CloudServiceListResult: val}, nil + return result, nil } // listAllHandleError handles the ListAll error response. -func (client *CloudServicesClient) listAllHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) listAllHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginPowerOff - Power off the cloud service. Note that resources are still attached and you are getting charged for the resources. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) BeginPowerOff(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginPowerOffOptions) (HTTPPollerResponse, error) { +func (client *CloudServicesClient) BeginPowerOff(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginPowerOffOptions) (CloudServicesPowerOffPollerResponse, error) { resp, err := client.powerOff(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("CloudServicesClient.PowerOff", "", resp, client.con.Pipeline(), client.powerOffHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesPowerOffPollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := CloudServicesPowerOffPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumePowerOff creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServicesClient) ResumePowerOff(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServicesClient.PowerOff", token, client.con.Pipeline(), client.powerOffHandleError) + pt, err := armruntime.NewPoller("CloudServicesClient.PowerOff", "", resp, client.pl, client.powerOffHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesPowerOffPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServicesPowerOffPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // PowerOff - Power off the cloud service. Note that resources are still attached and you are getting charged for the resources. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) powerOff(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginPowerOffOptions) (*azcore.Response, error) { +func (client *CloudServicesClient) powerOff(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginPowerOffOptions) (*http.Response, error) { req, err := client.powerOffCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.powerOffHandleError(resp) } return resp, nil } // powerOffCreateRequest creates the PowerOff request. -func (client *CloudServicesClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginPowerOffOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginPowerOffOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/poweroff" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -687,78 +566,49 @@ func (client *CloudServicesClient) powerOffCreateRequest(ctx context.Context, re return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // powerOffHandleError handles the PowerOff error response. -func (client *CloudServicesClient) powerOffHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) powerOffHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginRebuild - Rebuild Role Instances reinstalls the operating system on instances of web roles or worker roles and initializes the storage resources // that are used by them. If you do not want to initialize storage // resources, you can use Reimage Role Instances. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) BeginRebuild(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRebuildOptions) (HTTPPollerResponse, error) { +func (client *CloudServicesClient) BeginRebuild(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRebuildOptions) (CloudServicesRebuildPollerResponse, error) { resp, err := client.rebuild(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("CloudServicesClient.Rebuild", "", resp, client.con.Pipeline(), client.rebuildHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return CloudServicesRebuildPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := CloudServicesRebuildPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeRebuild creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServicesClient) ResumeRebuild(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServicesClient.Rebuild", token, client.con.Pipeline(), client.rebuildHandleError) + pt, err := armruntime.NewPoller("CloudServicesClient.Rebuild", "", resp, client.pl, client.rebuildHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesRebuildPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServicesRebuildPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } @@ -766,23 +616,23 @@ func (client *CloudServicesClient) ResumeRebuild(ctx context.Context, token stri // are used by them. If you do not want to initialize storage // resources, you can use Reimage Role Instances. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) rebuild(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRebuildOptions) (*azcore.Response, error) { +func (client *CloudServicesClient) rebuild(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRebuildOptions) (*http.Response, error) { req, err := client.rebuildCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.rebuildHandleError(resp) } return resp, nil } // rebuildCreateRequest creates the Rebuild request. -func (client *CloudServicesClient) rebuildCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRebuildOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) rebuildCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRebuildOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/rebuild" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -796,101 +646,72 @@ func (client *CloudServicesClient) rebuildCreateRequest(ctx context.Context, res return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { - return req, req.MarshalAsJSON(*options.Parameters) + return req, runtime.MarshalAsJSON(req, *options.Parameters) } return req, nil } // rebuildHandleError handles the Rebuild error response. -func (client *CloudServicesClient) rebuildHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) rebuildHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginReimage - Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) BeginReimage(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginReimageOptions) (HTTPPollerResponse, error) { +func (client *CloudServicesClient) BeginReimage(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginReimageOptions) (CloudServicesReimagePollerResponse, error) { resp, err := client.reimage(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesReimagePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := CloudServicesReimagePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("CloudServicesClient.Reimage", "", resp, client.con.Pipeline(), client.reimageHandleError) + pt, err := armruntime.NewPoller("CloudServicesClient.Reimage", "", resp, client.pl, client.reimageHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesReimagePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServicesReimagePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeReimage creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServicesClient) ResumeReimage(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServicesClient.Reimage", token, client.con.Pipeline(), client.reimageHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Reimage - Reimage asynchronous operation reinstalls the operating system on instances of web roles or worker roles. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) reimage(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginReimageOptions) (*azcore.Response, error) { +func (client *CloudServicesClient) reimage(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.reimageHandleError(resp) } return resp, nil } // reimageCreateRequest creates the Reimage request. -func (client *CloudServicesClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginReimageOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginReimageOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/reimage" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -904,101 +725,72 @@ func (client *CloudServicesClient) reimageCreateRequest(ctx context.Context, res return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { - return req, req.MarshalAsJSON(*options.Parameters) + return req, runtime.MarshalAsJSON(req, *options.Parameters) } return req, nil } // reimageHandleError handles the Reimage error response. -func (client *CloudServicesClient) reimageHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) reimageHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginRestart - Restarts one or more role instances in a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) BeginRestart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRestartOptions) (HTTPPollerResponse, error) { +func (client *CloudServicesClient) BeginRestart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRestartOptions) (CloudServicesRestartPollerResponse, error) { resp, err := client.restart(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesRestartPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := CloudServicesRestartPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("CloudServicesClient.Restart", "", resp, client.con.Pipeline(), client.restartHandleError) + pt, err := armruntime.NewPoller("CloudServicesClient.Restart", "", resp, client.pl, client.restartHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesRestartPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServicesRestartPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeRestart creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServicesClient) ResumeRestart(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServicesClient.Restart", token, client.con.Pipeline(), client.restartHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Restart - Restarts one or more role instances in a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) restart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRestartOptions) (*azcore.Response, error) { +func (client *CloudServicesClient) restart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.restartHandleError(resp) } return resp, nil } // restartCreateRequest creates the Restart request. -func (client *CloudServicesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRestartOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginRestartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/restart" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1012,101 +804,72 @@ func (client *CloudServicesClient) restartCreateRequest(ctx context.Context, res return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { - return req, req.MarshalAsJSON(*options.Parameters) + return req, runtime.MarshalAsJSON(req, *options.Parameters) } return req, nil } // restartHandleError handles the Restart error response. -func (client *CloudServicesClient) restartHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) restartHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginStart - Starts the cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) BeginStart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginStartOptions) (HTTPPollerResponse, error) { +func (client *CloudServicesClient) BeginStart(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginStartOptions) (CloudServicesStartPollerResponse, error) { resp, err := client.start(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("CloudServicesClient.Start", "", resp, client.con.Pipeline(), client.startHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return CloudServicesStartPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := CloudServicesStartPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeStart creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServicesClient) ResumeStart(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServicesClient.Start", token, client.con.Pipeline(), client.startHandleError) + pt, err := armruntime.NewPoller("CloudServicesClient.Start", "", resp, client.pl, client.startHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesStartPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServicesStartPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Start - Starts the cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) start(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginStartOptions) (*azcore.Response, error) { +func (client *CloudServicesClient) start(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.startHandleError(resp) } return resp, nil } // startCreateRequest creates the Start request. -func (client *CloudServicesClient) startCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginStartOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) startCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/start" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1120,98 +883,69 @@ func (client *CloudServicesClient) startCreateRequest(ctx context.Context, resou return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // startHandleError handles the Start error response. -func (client *CloudServicesClient) startHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) startHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - Update a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginUpdateOptions) (CloudServicePollerResponse, error) { +func (client *CloudServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginUpdateOptions) (CloudServicesUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, cloudServiceName, options) if err != nil { - return CloudServicePollerResponse{}, err - } - result := CloudServicePollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("CloudServicesClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return CloudServicePollerResponse{}, err - } - poller := &cloudServicePoller{ - pt: pt, + return CloudServicesUpdatePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (CloudServiceResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := CloudServicesUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new CloudServicePoller from the specified resume token. -// token - The value must come from a previous call to CloudServicePoller.ResumeToken(). -func (client *CloudServicesClient) ResumeUpdate(ctx context.Context, token string) (CloudServicePollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServicesClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("CloudServicesClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return CloudServicePollerResponse{}, err + return CloudServicesUpdatePollerResponse{}, err } - poller := &cloudServicePoller{ + result.Poller = &CloudServicesUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return CloudServicePollerResponse{}, err - } - result := CloudServicePollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (CloudServiceResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Update a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesClient) update(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginUpdateOptions) (*azcore.Response, error) { +func (client *CloudServicesClient) update(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, cloudServiceName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *CloudServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginUpdateOptions) (*azcore.Request, error) { +func (client *CloudServicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1225,30 +959,29 @@ func (client *CloudServicesClient) updateCreateRequest(ctx context.Context, reso return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { - return req, req.MarshalAsJSON(*options.Parameters) + return req, runtime.MarshalAsJSON(req, *options.Parameters) } return req, nil } // updateHandleError handles the Update error response. -func (client *CloudServicesClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_cloudservicesupdatedomain_client.go b/sdk/compute/armcompute/zz_generated_cloudservicesupdatedomain_client.go index d2bc0428de86..d228a3727ee2 100644 --- a/sdk/compute/armcompute/zz_generated_cloudservicesupdatedomain_client.go +++ b/sdk/compute/armcompute/zz_generated_cloudservicesupdatedomain_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,47 +12,50 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strconv" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // CloudServicesUpdateDomainClient contains the methods for the CloudServicesUpdateDomain group. // Don't use this type directly, use NewCloudServicesUpdateDomainClient() instead. type CloudServicesUpdateDomainClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewCloudServicesUpdateDomainClient creates a new instance of CloudServicesUpdateDomainClient with the specified values. -func NewCloudServicesUpdateDomainClient(con *armcore.Connection, subscriptionID string) *CloudServicesUpdateDomainClient { - return &CloudServicesUpdateDomainClient{con: con, subscriptionID: subscriptionID} +func NewCloudServicesUpdateDomainClient(con *arm.Connection, subscriptionID string) *CloudServicesUpdateDomainClient { + return &CloudServicesUpdateDomainClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // GetUpdateDomain - Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page of update domains. // Do this till nextLink is null to fetch all the update domains. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesUpdateDomainClient) GetUpdateDomain(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainGetUpdateDomainOptions) (UpdateDomainResponse, error) { +func (client *CloudServicesUpdateDomainClient) GetUpdateDomain(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainGetUpdateDomainOptions) (CloudServicesUpdateDomainGetUpdateDomainResponse, error) { req, err := client.getUpdateDomainCreateRequest(ctx, resourceGroupName, cloudServiceName, updateDomain, options) if err != nil { - return UpdateDomainResponse{}, err + return CloudServicesUpdateDomainGetUpdateDomainResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return UpdateDomainResponse{}, err + return CloudServicesUpdateDomainGetUpdateDomainResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return UpdateDomainResponse{}, client.getUpdateDomainHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CloudServicesUpdateDomainGetUpdateDomainResponse{}, client.getUpdateDomainHandleError(resp) } return client.getUpdateDomainHandleResponse(resp) } // getUpdateDomainCreateRequest creates the GetUpdateDomain request. -func (client *CloudServicesUpdateDomainClient) getUpdateDomainCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainGetUpdateDomainOptions) (*azcore.Request, error) { +func (client *CloudServicesUpdateDomainClient) getUpdateDomainCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainGetUpdateDomainOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -66,59 +70,55 @@ func (client *CloudServicesUpdateDomainClient) getUpdateDomainCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getUpdateDomainHandleResponse handles the GetUpdateDomain response. -func (client *CloudServicesUpdateDomainClient) getUpdateDomainHandleResponse(resp *azcore.Response) (UpdateDomainResponse, error) { - var val *UpdateDomain - if err := resp.UnmarshalAsJSON(&val); err != nil { - return UpdateDomainResponse{}, err +func (client *CloudServicesUpdateDomainClient) getUpdateDomainHandleResponse(resp *http.Response) (CloudServicesUpdateDomainGetUpdateDomainResponse, error) { + result := CloudServicesUpdateDomainGetUpdateDomainResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateDomain); err != nil { + return CloudServicesUpdateDomainGetUpdateDomainResponse{}, err } - return UpdateDomainResponse{RawResponse: resp.Response, UpdateDomain: val}, nil + return result, nil } // getUpdateDomainHandleError handles the GetUpdateDomain error response. -func (client *CloudServicesUpdateDomainClient) getUpdateDomainHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesUpdateDomainClient) getUpdateDomainHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListUpdateDomains - Gets a list of all update domains in a cloud service. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesUpdateDomainClient) ListUpdateDomains(resourceGroupName string, cloudServiceName string, options *CloudServicesUpdateDomainListUpdateDomainsOptions) UpdateDomainListResultPager { - return &updateDomainListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *CloudServicesUpdateDomainClient) ListUpdateDomains(resourceGroupName string, cloudServiceName string, options *CloudServicesUpdateDomainListUpdateDomainsOptions) *CloudServicesUpdateDomainListUpdateDomainsPager { + return &CloudServicesUpdateDomainListUpdateDomainsPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listUpdateDomainsCreateRequest(ctx, resourceGroupName, cloudServiceName, options) }, - responder: client.listUpdateDomainsHandleResponse, - errorer: client.listUpdateDomainsHandleError, - advancer: func(ctx context.Context, resp UpdateDomainListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.UpdateDomainListResult.NextLink) + advancer: func(ctx context.Context, resp CloudServicesUpdateDomainListUpdateDomainsResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.UpdateDomainListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listUpdateDomainsCreateRequest creates the ListUpdateDomains request. -func (client *CloudServicesUpdateDomainClient) listUpdateDomainsCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesUpdateDomainListUpdateDomainsOptions) (*azcore.Request, error) { +func (client *CloudServicesUpdateDomainClient) listUpdateDomainsCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, options *CloudServicesUpdateDomainListUpdateDomainsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -132,107 +132,78 @@ func (client *CloudServicesUpdateDomainClient) listUpdateDomainsCreateRequest(ct return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listUpdateDomainsHandleResponse handles the ListUpdateDomains response. -func (client *CloudServicesUpdateDomainClient) listUpdateDomainsHandleResponse(resp *azcore.Response) (UpdateDomainListResultResponse, error) { - var val *UpdateDomainListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return UpdateDomainListResultResponse{}, err +func (client *CloudServicesUpdateDomainClient) listUpdateDomainsHandleResponse(resp *http.Response) (CloudServicesUpdateDomainListUpdateDomainsResponse, error) { + result := CloudServicesUpdateDomainListUpdateDomainsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.UpdateDomainListResult); err != nil { + return CloudServicesUpdateDomainListUpdateDomainsResponse{}, err } - return UpdateDomainListResultResponse{RawResponse: resp.Response, UpdateDomainListResult: val}, nil + return result, nil } // listUpdateDomainsHandleError handles the ListUpdateDomains error response. -func (client *CloudServicesUpdateDomainClient) listUpdateDomainsHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesUpdateDomainClient) listUpdateDomainsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginWalkUpdateDomain - Updates the role instances in the specified update domain. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesUpdateDomainClient) BeginWalkUpdateDomain(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainBeginWalkUpdateDomainOptions) (HTTPPollerResponse, error) { +func (client *CloudServicesUpdateDomainClient) BeginWalkUpdateDomain(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainBeginWalkUpdateDomainOptions) (CloudServicesUpdateDomainWalkUpdateDomainPollerResponse, error) { resp, err := client.walkUpdateDomain(ctx, resourceGroupName, cloudServiceName, updateDomain, options) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesUpdateDomainWalkUpdateDomainPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := CloudServicesUpdateDomainWalkUpdateDomainPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("CloudServicesUpdateDomainClient.WalkUpdateDomain", "", resp, client.con.Pipeline(), client.walkUpdateDomainHandleError) + pt, err := armruntime.NewPoller("CloudServicesUpdateDomainClient.WalkUpdateDomain", "", resp, client.pl, client.walkUpdateDomainHandleError) if err != nil { - return HTTPPollerResponse{}, err + return CloudServicesUpdateDomainWalkUpdateDomainPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &CloudServicesUpdateDomainWalkUpdateDomainPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeWalkUpdateDomain creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *CloudServicesUpdateDomainClient) ResumeWalkUpdateDomain(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("CloudServicesUpdateDomainClient.WalkUpdateDomain", token, client.con.Pipeline(), client.walkUpdateDomainHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // WalkUpdateDomain - Updates the role instances in the specified update domain. // If the operation fails it returns the *CloudError error type. -func (client *CloudServicesUpdateDomainClient) walkUpdateDomain(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainBeginWalkUpdateDomainOptions) (*azcore.Response, error) { +func (client *CloudServicesUpdateDomainClient) walkUpdateDomain(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainBeginWalkUpdateDomainOptions) (*http.Response, error) { req, err := client.walkUpdateDomainCreateRequest(ctx, resourceGroupName, cloudServiceName, updateDomain, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.walkUpdateDomainHandleError(resp) } return resp, nil } // walkUpdateDomainCreateRequest creates the WalkUpdateDomain request. -func (client *CloudServicesUpdateDomainClient) walkUpdateDomainCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainBeginWalkUpdateDomainOptions) (*azcore.Request, error) { +func (client *CloudServicesUpdateDomainClient) walkUpdateDomainCreateRequest(ctx context.Context, resourceGroupName string, cloudServiceName string, updateDomain int32, options *CloudServicesUpdateDomainBeginWalkUpdateDomainOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/updateDomains/{updateDomain}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -247,30 +218,29 @@ func (client *CloudServicesUpdateDomainClient) walkUpdateDomainCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { - return req, req.MarshalAsJSON(*options.Parameters) + return req, runtime.MarshalAsJSON(req, *options.Parameters) } return req, nil } // walkUpdateDomainHandleError handles the WalkUpdateDomain error response. -func (client *CloudServicesUpdateDomainClient) walkUpdateDomainHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *CloudServicesUpdateDomainClient) walkUpdateDomainHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_constants.go b/sdk/compute/armcompute/zz_generated_constants.go index 640623b4c31f..3b166c48daa5 100644 --- a/sdk/compute/armcompute/zz_generated_constants.go +++ b/sdk/compute/armcompute/zz_generated_constants.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,7 +8,10 @@ package armcompute -const telemetryInfo = "azsdk-go-armcompute/v0.2.0" +const ( + module = "armcompute" + version = "v0.3.0" +) type AccessLevel string @@ -106,6 +110,42 @@ func (c CachingTypes) ToPtr() *CachingTypes { return &c } +type CapacityReservationGroupInstanceViewTypes string + +const ( + CapacityReservationGroupInstanceViewTypesInstanceView CapacityReservationGroupInstanceViewTypes = "instanceView" +) + +// PossibleCapacityReservationGroupInstanceViewTypesValues returns the possible values for the CapacityReservationGroupInstanceViewTypes const type. +func PossibleCapacityReservationGroupInstanceViewTypesValues() []CapacityReservationGroupInstanceViewTypes { + return []CapacityReservationGroupInstanceViewTypes{ + CapacityReservationGroupInstanceViewTypesInstanceView, + } +} + +// ToPtr returns a *CapacityReservationGroupInstanceViewTypes pointing to the current value. +func (c CapacityReservationGroupInstanceViewTypes) ToPtr() *CapacityReservationGroupInstanceViewTypes { + return &c +} + +type CapacityReservationInstanceViewTypes string + +const ( + CapacityReservationInstanceViewTypesInstanceView CapacityReservationInstanceViewTypes = "instanceView" +) + +// PossibleCapacityReservationInstanceViewTypesValues returns the possible values for the CapacityReservationInstanceViewTypes const type. +func PossibleCapacityReservationInstanceViewTypesValues() []CapacityReservationInstanceViewTypes { + return []CapacityReservationInstanceViewTypes{ + CapacityReservationInstanceViewTypesInstanceView, + } +} + +// ToPtr returns a *CapacityReservationInstanceViewTypes pointing to the current value. +func (c CapacityReservationInstanceViewTypes) ToPtr() *CapacityReservationInstanceViewTypes { + return &c +} + // CloudServiceUpgradeMode - Update mode for the cloud service. Role instances are allocated to update domains when the service is deployed. Updates can // be initiated manually in each update domain or initiated automatically in // all update domains. Possible Values are @@ -569,6 +609,26 @@ func (c ExecutionState) ToPtr() *ExecutionState { return &c } +type ExpandTypesForGetCapacityReservationGroups string + +const ( + ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef ExpandTypesForGetCapacityReservationGroups = "virtualMachineScaleSetVMs/$ref" + ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef ExpandTypesForGetCapacityReservationGroups = "virtualMachines/$ref" +) + +// PossibleExpandTypesForGetCapacityReservationGroupsValues returns the possible values for the ExpandTypesForGetCapacityReservationGroups const type. +func PossibleExpandTypesForGetCapacityReservationGroupsValues() []ExpandTypesForGetCapacityReservationGroups { + return []ExpandTypesForGetCapacityReservationGroups{ + ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef, + ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef, + } +} + +// ToPtr returns a *ExpandTypesForGetCapacityReservationGroups pointing to the current value. +func (c ExpandTypesForGetCapacityReservationGroups) ToPtr() *ExpandTypesForGetCapacityReservationGroups { + return &c +} + type ExpandTypesForGetVMScaleSets string const ( @@ -587,6 +647,25 @@ func (c ExpandTypesForGetVMScaleSets) ToPtr() *ExpandTypesForGetVMScaleSets { return &c } +// ExtendedLocationType - The type of the extended location. +type ExtendedLocationType string + +const ( + ExtendedLocationTypeEdgeZone ExtendedLocationType = "EdgeZone" +) + +// PossibleExtendedLocationTypeValues returns the possible values for the ExtendedLocationType const type. +func PossibleExtendedLocationTypeValues() []ExtendedLocationType { + return []ExtendedLocationType{ + ExtendedLocationTypeEdgeZone, + } +} + +// ToPtr returns a *ExtendedLocationType pointing to the current value. +func (c ExtendedLocationType) ToPtr() *ExtendedLocationType { + return &c +} + // ExtendedLocationTypes - The type of extendedLocation. type ExtendedLocationTypes string @@ -1040,11 +1119,13 @@ func (c NetworkAccessPolicy) ToPtr() *NetworkAccessPolicy { return &c } -// OperatingSystemStateTypes - This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. +// OperatingSystemStateTypes - The OS State. type OperatingSystemStateTypes string const ( + // OperatingSystemStateTypesGeneralized - Generalized image. Needs to be provisioned during deployment time. OperatingSystemStateTypesGeneralized OperatingSystemStateTypes = "Generalized" + // OperatingSystemStateTypesSpecialized - Specialized image. Contains already provisioned OS Disk. OperatingSystemStateTypesSpecialized OperatingSystemStateTypes = "Specialized" ) @@ -1082,10 +1163,7 @@ func (c OperatingSystemType) ToPtr() *OperatingSystemType { return &c } -// OperatingSystemTypes - This property allows you to specify the supported type of the OS that application is built for. -// Possible values are: -// Windows -// Linux +// OperatingSystemTypes - The Operating System type. type OperatingSystemTypes string const ( @@ -1428,6 +1506,27 @@ func (c PublicIPAllocationMethod) ToPtr() *PublicIPAllocationMethod { return &c } +// ReplicationMode - Optional parameter which specifies the mode to be used for replication. This property is not updatable. +type ReplicationMode string + +const ( + ReplicationModeFull ReplicationMode = "Full" + ReplicationModeShallow ReplicationMode = "Shallow" +) + +// PossibleReplicationModeValues returns the possible values for the ReplicationMode const type. +func PossibleReplicationModeValues() []ReplicationMode { + return []ReplicationMode{ + ReplicationModeFull, + ReplicationModeShallow, + } +} + +// ToPtr returns a *ReplicationMode pointing to the current value. +func (c ReplicationMode) ToPtr() *ReplicationMode { + return &c +} + // ReplicationState - This is the regional replication state. type ReplicationState string @@ -1627,6 +1726,26 @@ func (c RollingUpgradeStatusCode) ToPtr() *RollingUpgradeStatusCode { return &c } +// SecurityTypes - Specifies the SecurityType of the virtual machine. It is set as TrustedLaunch to enable UefiSettings. +// Default: UefiSettings will not be enabled unless this property is set as TrustedLaunch. +type SecurityTypes string + +const ( + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +// PossibleSecurityTypesValues returns the possible values for the SecurityTypes const type. +func PossibleSecurityTypesValues() []SecurityTypes { + return []SecurityTypes{ + SecurityTypesTrustedLaunch, + } +} + +// ToPtr returns a *SecurityTypes pointing to the current value. +func (c SecurityTypes) ToPtr() *SecurityTypes { + return &c +} + type SelectPermissions string const ( diff --git a/sdk/compute/armcompute/zz_generated_dedicatedhostgroups_client.go b/sdk/compute/armcompute/zz_generated_dedicatedhostgroups_client.go index 789814e0f79d..216517f20e1a 100644 --- a/sdk/compute/armcompute/zz_generated_dedicatedhostgroups_client.go +++ b/sdk/compute/armcompute/zz_generated_dedicatedhostgroups_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,45 +11,48 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // DedicatedHostGroupsClient contains the methods for the DedicatedHostGroups group. // Don't use this type directly, use NewDedicatedHostGroupsClient() instead. type DedicatedHostGroupsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewDedicatedHostGroupsClient creates a new instance of DedicatedHostGroupsClient with the specified values. -func NewDedicatedHostGroupsClient(con *armcore.Connection, subscriptionID string) *DedicatedHostGroupsClient { - return &DedicatedHostGroupsClient{con: con, subscriptionID: subscriptionID} +func NewDedicatedHostGroupsClient(con *arm.Connection, subscriptionID string) *DedicatedHostGroupsClient { + return &DedicatedHostGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // CreateOrUpdate - Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see Dedicated Host Documentation // [https://go.microsoft.com/fwlink/?linkid=2082596] // If the operation fails it returns a generic error. -func (client *DedicatedHostGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroup, options *DedicatedHostGroupsCreateOrUpdateOptions) (DedicatedHostGroupResponse, error) { +func (client *DedicatedHostGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroup, options *DedicatedHostGroupsCreateOrUpdateOptions) (DedicatedHostGroupsCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, hostGroupName, parameters, options) if err != nil { - return DedicatedHostGroupResponse{}, err + return DedicatedHostGroupsCreateOrUpdateResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return DedicatedHostGroupResponse{}, err + return DedicatedHostGroupsCreateOrUpdateResponse{}, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { - return DedicatedHostGroupResponse{}, client.createOrUpdateHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return DedicatedHostGroupsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) } return client.createOrUpdateHandleResponse(resp) } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DedicatedHostGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroup, options *DedicatedHostGroupsCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *DedicatedHostGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroup, options *DedicatedHostGroupsCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -62,58 +66,57 @@ func (client *DedicatedHostGroupsClient) createOrUpdateCreateRequest(ctx context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *DedicatedHostGroupsClient) createOrUpdateHandleResponse(resp *azcore.Response) (DedicatedHostGroupResponse, error) { - var val *DedicatedHostGroup - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DedicatedHostGroupResponse{}, err +func (client *DedicatedHostGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (DedicatedHostGroupsCreateOrUpdateResponse, error) { + result := DedicatedHostGroupsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroup); err != nil { + return DedicatedHostGroupsCreateOrUpdateResponse{}, err } - return DedicatedHostGroupResponse{RawResponse: resp.Response, DedicatedHostGroup: val}, nil + return result, nil } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *DedicatedHostGroupsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostGroupsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Delete - Delete a dedicated host group. // If the operation fails it returns a generic error. -func (client *DedicatedHostGroupsClient) Delete(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsDeleteOptions) (*http.Response, error) { +func (client *DedicatedHostGroupsClient) Delete(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsDeleteOptions) (DedicatedHostGroupsDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostGroupName, options) if err != nil { - return nil, err + return DedicatedHostGroupsDeleteResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return nil, err + return DedicatedHostGroupsDeleteResponse{}, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusNoContent) { - return nil, client.deleteHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return DedicatedHostGroupsDeleteResponse{}, client.deleteHandleError(resp) } - return resp.Response, nil + return DedicatedHostGroupsDeleteResponse{RawResponse: resp}, nil } // deleteCreateRequest creates the Delete request. -func (client *DedicatedHostGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsDeleteOptions) (*azcore.Request, error) { +func (client *DedicatedHostGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -127,48 +130,47 @@ func (client *DedicatedHostGroupsClient) deleteCreateRequest(ctx context.Context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *DedicatedHostGroupsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostGroupsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Retrieves information about a dedicated host group. // If the operation fails it returns a generic error. -func (client *DedicatedHostGroupsClient) Get(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsGetOptions) (DedicatedHostGroupResponse, error) { +func (client *DedicatedHostGroupsClient) Get(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsGetOptions) (DedicatedHostGroupsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, hostGroupName, options) if err != nil { - return DedicatedHostGroupResponse{}, err + return DedicatedHostGroupsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return DedicatedHostGroupResponse{}, err + return DedicatedHostGroupsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return DedicatedHostGroupResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostGroupsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *DedicatedHostGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsGetOptions) (*azcore.Request, error) { +func (client *DedicatedHostGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostGroupsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -182,62 +184,58 @@ func (client *DedicatedHostGroupsClient) getCreateRequest(ctx context.Context, r return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *DedicatedHostGroupsClient) getHandleResponse(resp *azcore.Response) (DedicatedHostGroupResponse, error) { - var val *DedicatedHostGroup - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DedicatedHostGroupResponse{}, err +func (client *DedicatedHostGroupsClient) getHandleResponse(resp *http.Response) (DedicatedHostGroupsGetResponse, error) { + result := DedicatedHostGroupsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroup); err != nil { + return DedicatedHostGroupsGetResponse{}, err } - return DedicatedHostGroupResponse{RawResponse: resp.Response, DedicatedHostGroup: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *DedicatedHostGroupsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostGroupsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListByResourceGroup - 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. // If the operation fails it returns a generic error. -func (client *DedicatedHostGroupsClient) ListByResourceGroup(resourceGroupName string, options *DedicatedHostGroupsListByResourceGroupOptions) DedicatedHostGroupListResultPager { - return &dedicatedHostGroupListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DedicatedHostGroupsClient) ListByResourceGroup(resourceGroupName string, options *DedicatedHostGroupsListByResourceGroupOptions) *DedicatedHostGroupsListByResourceGroupPager { + return &DedicatedHostGroupsListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listByResourceGroupHandleResponse, - errorer: client.listByResourceGroupHandleError, - advancer: func(ctx context.Context, resp DedicatedHostGroupListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.DedicatedHostGroupListResult.NextLink) + advancer: func(ctx context.Context, resp DedicatedHostGroupsListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DedicatedHostGroupListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *DedicatedHostGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DedicatedHostGroupsListByResourceGroupOptions) (*azcore.Request, error) { +func (client *DedicatedHostGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DedicatedHostGroupsListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -247,116 +245,111 @@ func (client *DedicatedHostGroupsClient) listByResourceGroupCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *DedicatedHostGroupsClient) listByResourceGroupHandleResponse(resp *azcore.Response) (DedicatedHostGroupListResultResponse, error) { - var val *DedicatedHostGroupListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DedicatedHostGroupListResultResponse{}, err +func (client *DedicatedHostGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (DedicatedHostGroupsListByResourceGroupResponse, error) { + result := DedicatedHostGroupsListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroupListResult); err != nil { + return DedicatedHostGroupsListByResourceGroupResponse{}, err } - return DedicatedHostGroupListResultResponse{RawResponse: resp.Response, DedicatedHostGroupListResult: val}, nil + return result, nil } // listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *DedicatedHostGroupsClient) listByResourceGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostGroupsClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListBySubscription - 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. // If the operation fails it returns a generic error. -func (client *DedicatedHostGroupsClient) ListBySubscription(options *DedicatedHostGroupsListBySubscriptionOptions) DedicatedHostGroupListResultPager { - return &dedicatedHostGroupListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DedicatedHostGroupsClient) ListBySubscription(options *DedicatedHostGroupsListBySubscriptionOptions) *DedicatedHostGroupsListBySubscriptionPager { + return &DedicatedHostGroupsListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listBySubscriptionCreateRequest(ctx, options) }, - responder: client.listBySubscriptionHandleResponse, - errorer: client.listBySubscriptionHandleError, - advancer: func(ctx context.Context, resp DedicatedHostGroupListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.DedicatedHostGroupListResult.NextLink) + advancer: func(ctx context.Context, resp DedicatedHostGroupsListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DedicatedHostGroupListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *DedicatedHostGroupsClient) listBySubscriptionCreateRequest(ctx context.Context, options *DedicatedHostGroupsListBySubscriptionOptions) (*azcore.Request, error) { +func (client *DedicatedHostGroupsClient) listBySubscriptionCreateRequest(ctx context.Context, options *DedicatedHostGroupsListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *DedicatedHostGroupsClient) listBySubscriptionHandleResponse(resp *azcore.Response) (DedicatedHostGroupListResultResponse, error) { - var val *DedicatedHostGroupListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DedicatedHostGroupListResultResponse{}, err +func (client *DedicatedHostGroupsClient) listBySubscriptionHandleResponse(resp *http.Response) (DedicatedHostGroupsListBySubscriptionResponse, error) { + result := DedicatedHostGroupsListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroupListResult); err != nil { + return DedicatedHostGroupsListBySubscriptionResponse{}, err } - return DedicatedHostGroupListResultResponse{RawResponse: resp.Response, DedicatedHostGroupListResult: val}, nil + return result, nil } // listBySubscriptionHandleError handles the ListBySubscription error response. -func (client *DedicatedHostGroupsClient) listBySubscriptionHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostGroupsClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Update - Update an dedicated host group. // If the operation fails it returns a generic error. -func (client *DedicatedHostGroupsClient) Update(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroupUpdate, options *DedicatedHostGroupsUpdateOptions) (DedicatedHostGroupResponse, error) { +func (client *DedicatedHostGroupsClient) Update(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroupUpdate, options *DedicatedHostGroupsUpdateOptions) (DedicatedHostGroupsUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, hostGroupName, parameters, options) if err != nil { - return DedicatedHostGroupResponse{}, err + return DedicatedHostGroupsUpdateResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return DedicatedHostGroupResponse{}, err + return DedicatedHostGroupsUpdateResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return DedicatedHostGroupResponse{}, client.updateHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostGroupsUpdateResponse{}, client.updateHandleError(resp) } return client.updateHandleResponse(resp) } // updateCreateRequest creates the Update request. -func (client *DedicatedHostGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroupUpdate, options *DedicatedHostGroupsUpdateOptions) (*azcore.Request, error) { +func (client *DedicatedHostGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, parameters DedicatedHostGroupUpdate, options *DedicatedHostGroupsUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -370,35 +363,34 @@ func (client *DedicatedHostGroupsClient) updateCreateRequest(ctx context.Context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // updateHandleResponse handles the Update response. -func (client *DedicatedHostGroupsClient) updateHandleResponse(resp *azcore.Response) (DedicatedHostGroupResponse, error) { - var val *DedicatedHostGroup - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DedicatedHostGroupResponse{}, err +func (client *DedicatedHostGroupsClient) updateHandleResponse(resp *http.Response) (DedicatedHostGroupsUpdateResponse, error) { + result := DedicatedHostGroupsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroup); err != nil { + return DedicatedHostGroupsUpdateResponse{}, err } - return DedicatedHostGroupResponse{RawResponse: resp.Response, DedicatedHostGroup: val}, nil + return result, nil } // updateHandleError handles the Update error response. -func (client *DedicatedHostGroupsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostGroupsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_dedicatedhosts_client.go b/sdk/compute/armcompute/zz_generated_dedicatedhosts_client.go index 2fc2a83916e1..6e955d7260a5 100644 --- a/sdk/compute/armcompute/zz_generated_dedicatedhosts_client.go +++ b/sdk/compute/armcompute/zz_generated_dedicatedhosts_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,93 +11,68 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // DedicatedHostsClient contains the methods for the DedicatedHosts group. // Don't use this type directly, use NewDedicatedHostsClient() instead. type DedicatedHostsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewDedicatedHostsClient creates a new instance of DedicatedHostsClient with the specified values. -func NewDedicatedHostsClient(con *armcore.Connection, subscriptionID string) *DedicatedHostsClient { - return &DedicatedHostsClient{con: con, subscriptionID: subscriptionID} +func NewDedicatedHostsClient(con *arm.Connection, subscriptionID string) *DedicatedHostsClient { + return &DedicatedHostsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Create or update a dedicated host . // If the operation fails it returns a generic error. -func (client *DedicatedHostsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsBeginCreateOrUpdateOptions) (DedicatedHostPollerResponse, error) { +func (client *DedicatedHostsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsBeginCreateOrUpdateOptions) (DedicatedHostsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) if err != nil { - return DedicatedHostPollerResponse{}, err + return DedicatedHostsCreateOrUpdatePollerResponse{}, err } - result := DedicatedHostPollerResponse{ - RawResponse: resp.Response, + result := DedicatedHostsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("DedicatedHostsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("DedicatedHostsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return DedicatedHostPollerResponse{}, err + return DedicatedHostsCreateOrUpdatePollerResponse{}, err } - poller := &dedicatedHostPoller{ + result.Poller = &DedicatedHostsCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DedicatedHostResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new DedicatedHostPoller from the specified resume token. -// token - The value must come from a previous call to DedicatedHostPoller.ResumeToken(). -func (client *DedicatedHostsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (DedicatedHostPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DedicatedHostsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return DedicatedHostPollerResponse{}, err - } - poller := &dedicatedHostPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return DedicatedHostPollerResponse{}, err - } - result := DedicatedHostPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DedicatedHostResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Create or update a dedicated host . // If the operation fails it returns a generic error. -func (client *DedicatedHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *DedicatedHostsClient) createOrUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DedicatedHostsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *DedicatedHostsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHost, options *DedicatedHostsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -114,97 +90,68 @@ func (client *DedicatedHostsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *DedicatedHostsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDelete - Delete a dedicated host. // If the operation fails it returns a generic error. -func (client *DedicatedHostsClient) BeginDelete(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *DedicatedHostsClient) BeginDelete(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsBeginDeleteOptions) (DedicatedHostsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, hostGroupName, hostName, options) if err != nil { - return HTTPPollerResponse{}, err + return DedicatedHostsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := DedicatedHostsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("DedicatedHostsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("DedicatedHostsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return DedicatedHostsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &DedicatedHostsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *DedicatedHostsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DedicatedHostsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Delete a dedicated host. // If the operation fails it returns a generic error. -func (client *DedicatedHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsBeginDeleteOptions) (*azcore.Response, error) { +func (client *DedicatedHostsClient) deleteOperation(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *DedicatedHostsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsBeginDeleteOptions) (*azcore.Request, error) { +func (client *DedicatedHostsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -222,48 +169,47 @@ func (client *DedicatedHostsClient) deleteCreateRequest(ctx context.Context, res return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *DedicatedHostsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Retrieves information about a dedicated host. // If the operation fails it returns a generic error. -func (client *DedicatedHostsClient) Get(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsGetOptions) (DedicatedHostResponse, error) { +func (client *DedicatedHostsClient) Get(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsGetOptions) (DedicatedHostsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, options) if err != nil { - return DedicatedHostResponse{}, err + return DedicatedHostsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return DedicatedHostResponse{}, err + return DedicatedHostsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return DedicatedHostResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DedicatedHostsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *DedicatedHostsClient) getCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsGetOptions) (*azcore.Request, error) { +func (client *DedicatedHostsClient) getCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, options *DedicatedHostsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -281,62 +227,58 @@ func (client *DedicatedHostsClient) getCreateRequest(ctx context.Context, resour return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *DedicatedHostsClient) getHandleResponse(resp *azcore.Response) (DedicatedHostResponse, error) { - var val *DedicatedHost - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DedicatedHostResponse{}, err +func (client *DedicatedHostsClient) getHandleResponse(resp *http.Response) (DedicatedHostsGetResponse, error) { + result := DedicatedHostsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHost); err != nil { + return DedicatedHostsGetResponse{}, err } - return DedicatedHostResponse{RawResponse: resp.Response, DedicatedHost: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *DedicatedHostsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListByHostGroup - 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. // If the operation fails it returns a generic error. -func (client *DedicatedHostsClient) ListByHostGroup(resourceGroupName string, hostGroupName string, options *DedicatedHostsListByHostGroupOptions) DedicatedHostListResultPager { - return &dedicatedHostListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DedicatedHostsClient) ListByHostGroup(resourceGroupName string, hostGroupName string, options *DedicatedHostsListByHostGroupOptions) *DedicatedHostsListByHostGroupPager { + return &DedicatedHostsListByHostGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByHostGroupCreateRequest(ctx, resourceGroupName, hostGroupName, options) }, - responder: client.listByHostGroupHandleResponse, - errorer: client.listByHostGroupHandleError, - advancer: func(ctx context.Context, resp DedicatedHostListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.DedicatedHostListResult.NextLink) + advancer: func(ctx context.Context, resp DedicatedHostsListByHostGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DedicatedHostListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByHostGroupCreateRequest creates the ListByHostGroup request. -func (client *DedicatedHostsClient) listByHostGroupCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostsListByHostGroupOptions) (*azcore.Request, error) { +func (client *DedicatedHostsClient) listByHostGroupCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, options *DedicatedHostsListByHostGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -350,106 +292,77 @@ func (client *DedicatedHostsClient) listByHostGroupCreateRequest(ctx context.Con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByHostGroupHandleResponse handles the ListByHostGroup response. -func (client *DedicatedHostsClient) listByHostGroupHandleResponse(resp *azcore.Response) (DedicatedHostListResultResponse, error) { - var val *DedicatedHostListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DedicatedHostListResultResponse{}, err +func (client *DedicatedHostsClient) listByHostGroupHandleResponse(resp *http.Response) (DedicatedHostsListByHostGroupResponse, error) { + result := DedicatedHostsListByHostGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostListResult); err != nil { + return DedicatedHostsListByHostGroupResponse{}, err } - return DedicatedHostListResultResponse{RawResponse: resp.Response, DedicatedHostListResult: val}, nil + return result, nil } // listByHostGroupHandleError handles the ListByHostGroup error response. -func (client *DedicatedHostsClient) listByHostGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostsClient) listByHostGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginUpdate - Update an dedicated host . // If the operation fails it returns a generic error. -func (client *DedicatedHostsClient) BeginUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsBeginUpdateOptions) (DedicatedHostPollerResponse, error) { +func (client *DedicatedHostsClient) BeginUpdate(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsBeginUpdateOptions) (DedicatedHostsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) if err != nil { - return DedicatedHostPollerResponse{}, err - } - result := DedicatedHostPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("DedicatedHostsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return DedicatedHostPollerResponse{}, err + return DedicatedHostsUpdatePollerResponse{}, err } - poller := &dedicatedHostPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DedicatedHostResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := DedicatedHostsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new DedicatedHostPoller from the specified resume token. -// token - The value must come from a previous call to DedicatedHostPoller.ResumeToken(). -func (client *DedicatedHostsClient) ResumeUpdate(ctx context.Context, token string) (DedicatedHostPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DedicatedHostsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("DedicatedHostsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return DedicatedHostPollerResponse{}, err + return DedicatedHostsUpdatePollerResponse{}, err } - poller := &dedicatedHostPoller{ + result.Poller = &DedicatedHostsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return DedicatedHostPollerResponse{}, err - } - result := DedicatedHostPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DedicatedHostResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Update an dedicated host . // If the operation fails it returns a generic error. -func (client *DedicatedHostsClient) update(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsBeginUpdateOptions) (*azcore.Response, error) { +func (client *DedicatedHostsClient) update(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, hostGroupName, hostName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *DedicatedHostsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsBeginUpdateOptions) (*azcore.Request, error) { +func (client *DedicatedHostsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, hostGroupName string, hostName string, parameters DedicatedHostUpdate, options *DedicatedHostsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -467,26 +380,25 @@ func (client *DedicatedHostsClient) updateCreateRequest(ctx context.Context, res return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // updateHandleError handles the Update error response. -func (client *DedicatedHostsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DedicatedHostsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_diskaccesses_client.go b/sdk/compute/armcompute/zz_generated_diskaccesses_client.go index 731c31df55ec..849c2492362d 100644 --- a/sdk/compute/armcompute/zz_generated_diskaccesses_client.go +++ b/sdk/compute/armcompute/zz_generated_diskaccesses_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // DiskAccessesClient contains the methods for the DiskAccesses group. // Don't use this type directly, use NewDiskAccessesClient() instead. type DiskAccessesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewDiskAccessesClient creates a new instance of DiskAccessesClient with the specified values. -func NewDiskAccessesClient(con *armcore.Connection, subscriptionID string) *DiskAccessesClient { - return &DiskAccessesClient{con: con, subscriptionID: subscriptionID} +func NewDiskAccessesClient(con *arm.Connection, subscriptionID string) *DiskAccessesClient { + return &DiskAccessesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Creates or updates a disk access resource // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesBeginCreateOrUpdateOptions) (DiskAccessPollerResponse, error) { +func (client *DiskAccessesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesBeginCreateOrUpdateOptions) (DiskAccessesCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, diskAccessName, diskAccess, options) if err != nil { - return DiskAccessPollerResponse{}, err - } - result := DiskAccessPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("DiskAccessesClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return DiskAccessPollerResponse{}, err - } - poller := &diskAccessPoller{ - pt: pt, + return DiskAccessesCreateOrUpdatePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskAccessResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := DiskAccessesCreateOrUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeCreateOrUpdate creates a new DiskAccessPoller from the specified resume token. -// token - The value must come from a previous call to DiskAccessPoller.ResumeToken(). -func (client *DiskAccessesClient) ResumeCreateOrUpdate(ctx context.Context, token string) (DiskAccessPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DiskAccessesClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("DiskAccessesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return DiskAccessPollerResponse{}, err + return DiskAccessesCreateOrUpdatePollerResponse{}, err } - poller := &diskAccessPoller{ + result.Poller = &DiskAccessesCreateOrUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return DiskAccessPollerResponse{}, err - } - result := DiskAccessPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskAccessResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Creates or updates a disk access resource // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *DiskAccessesClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, diskAccessName, diskAccess, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DiskAccessesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccess, options *DiskAccessesBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -111,98 +87,69 @@ func (client *DiskAccessesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, errors.New("parameter diskAccessName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(diskAccess) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, diskAccess) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *DiskAccessesClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - Deletes a disk access resource. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) BeginDelete(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *DiskAccessesClient) BeginDelete(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesBeginDeleteOptions) (DiskAccessesDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, diskAccessName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("DiskAccessesClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return DiskAccessesDeletePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := DiskAccessesDeletePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *DiskAccessesClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DiskAccessesClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("DiskAccessesClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return DiskAccessesDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &DiskAccessesDeletePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Deletes a disk access resource. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) deleteOperation(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesBeginDeleteOptions) (*azcore.Response, error) { +func (client *DiskAccessesClient) deleteOperation(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, diskAccessName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *DiskAccessesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesBeginDeleteOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -216,98 +163,69 @@ func (client *DiskAccessesClient) deleteCreateRequest(ctx context.Context, resou return nil, errors.New("parameter diskAccessName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *DiskAccessesClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDeleteAPrivateEndpointConnection - Deletes a private endpoint connection under a disk access resource. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) BeginDeleteAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesBeginDeleteAPrivateEndpointConnectionOptions) (HTTPPollerResponse, error) { +func (client *DiskAccessesClient) BeginDeleteAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesBeginDeleteAPrivateEndpointConnectionOptions) (DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse, error) { resp, err := client.deleteAPrivateEndpointConnection(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, options) if err != nil { - return HTTPPollerResponse{}, err + return DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("DiskAccessesClient.DeleteAPrivateEndpointConnection", "", resp, client.con.Pipeline(), client.deleteAPrivateEndpointConnectionHandleError) + pt, err := armruntime.NewPoller("DiskAccessesClient.DeleteAPrivateEndpointConnection", "", resp, client.pl, client.deleteAPrivateEndpointConnectionHandleError) if err != nil { - return HTTPPollerResponse{}, err + return DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &DiskAccessesDeleteAPrivateEndpointConnectionPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDeleteAPrivateEndpointConnection creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *DiskAccessesClient) ResumeDeleteAPrivateEndpointConnection(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DiskAccessesClient.DeleteAPrivateEndpointConnection", token, client.con.Pipeline(), client.deleteAPrivateEndpointConnectionHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // DeleteAPrivateEndpointConnection - Deletes a private endpoint connection under a disk access resource. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) deleteAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesBeginDeleteAPrivateEndpointConnectionOptions) (*azcore.Response, error) { +func (client *DiskAccessesClient) deleteAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesBeginDeleteAPrivateEndpointConnectionOptions) (*http.Response, error) { req, err := client.deleteAPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteAPrivateEndpointConnectionHandleError(resp) } return resp, nil } // deleteAPrivateEndpointConnectionCreateRequest creates the DeleteAPrivateEndpointConnection request. -func (client *DiskAccessesClient) deleteAPrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesBeginDeleteAPrivateEndpointConnectionOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) deleteAPrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesBeginDeleteAPrivateEndpointConnectionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -325,50 +243,49 @@ func (client *DiskAccessesClient) deleteAPrivateEndpointConnectionCreateRequest( return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteAPrivateEndpointConnectionHandleError handles the DeleteAPrivateEndpointConnection error response. -func (client *DiskAccessesClient) deleteAPrivateEndpointConnectionHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) deleteAPrivateEndpointConnectionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - Gets information about a disk access resource. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) Get(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesGetOptions) (DiskAccessResponse, error) { +func (client *DiskAccessesClient) Get(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesGetOptions) (DiskAccessesGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, diskAccessName, options) if err != nil { - return DiskAccessResponse{}, err + return DiskAccessesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return DiskAccessResponse{}, err + return DiskAccessesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return DiskAccessResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskAccessesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *DiskAccessesClient) getCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesGetOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) getCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -382,59 +299,58 @@ func (client *DiskAccessesClient) getCreateRequest(ctx context.Context, resource return nil, errors.New("parameter diskAccessName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *DiskAccessesClient) getHandleResponse(resp *azcore.Response) (DiskAccessResponse, error) { - var val *DiskAccess - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskAccessResponse{}, err +func (client *DiskAccessesClient) getHandleResponse(resp *http.Response) (DiskAccessesGetResponse, error) { + result := DiskAccessesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskAccess); err != nil { + return DiskAccessesGetResponse{}, err } - return DiskAccessResponse{RawResponse: resp.Response, DiskAccess: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *DiskAccessesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // GetAPrivateEndpointConnection - Gets information about a private endpoint connection under a disk access resource. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) GetAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesGetAPrivateEndpointConnectionOptions) (PrivateEndpointConnectionResponse, error) { +func (client *DiskAccessesClient) GetAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesGetAPrivateEndpointConnectionOptions) (DiskAccessesGetAPrivateEndpointConnectionResponse, error) { req, err := client.getAPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, options) if err != nil { - return PrivateEndpointConnectionResponse{}, err + return DiskAccessesGetAPrivateEndpointConnectionResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return PrivateEndpointConnectionResponse{}, err + return DiskAccessesGetAPrivateEndpointConnectionResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return PrivateEndpointConnectionResponse{}, client.getAPrivateEndpointConnectionHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskAccessesGetAPrivateEndpointConnectionResponse{}, client.getAPrivateEndpointConnectionHandleError(resp) } return client.getAPrivateEndpointConnectionHandleResponse(resp) } // getAPrivateEndpointConnectionCreateRequest creates the GetAPrivateEndpointConnection request. -func (client *DiskAccessesClient) getAPrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesGetAPrivateEndpointConnectionOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) getAPrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, options *DiskAccessesGetAPrivateEndpointConnectionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -452,59 +368,58 @@ func (client *DiskAccessesClient) getAPrivateEndpointConnectionCreateRequest(ctx return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getAPrivateEndpointConnectionHandleResponse handles the GetAPrivateEndpointConnection response. -func (client *DiskAccessesClient) getAPrivateEndpointConnectionHandleResponse(resp *azcore.Response) (PrivateEndpointConnectionResponse, error) { - var val *PrivateEndpointConnection - if err := resp.UnmarshalAsJSON(&val); err != nil { - return PrivateEndpointConnectionResponse{}, err +func (client *DiskAccessesClient) getAPrivateEndpointConnectionHandleResponse(resp *http.Response) (DiskAccessesGetAPrivateEndpointConnectionResponse, error) { + result := DiskAccessesGetAPrivateEndpointConnectionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return DiskAccessesGetAPrivateEndpointConnectionResponse{}, err } - return PrivateEndpointConnectionResponse{RawResponse: resp.Response, PrivateEndpointConnection: val}, nil + return result, nil } // getAPrivateEndpointConnectionHandleError handles the GetAPrivateEndpointConnection error response. -func (client *DiskAccessesClient) getAPrivateEndpointConnectionHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) getAPrivateEndpointConnectionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // GetPrivateLinkResources - Gets the private link resources possible under disk access resource // If the operation fails it returns a generic error. -func (client *DiskAccessesClient) GetPrivateLinkResources(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesGetPrivateLinkResourcesOptions) (PrivateLinkResourceListResultResponse, error) { +func (client *DiskAccessesClient) GetPrivateLinkResources(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesGetPrivateLinkResourcesOptions) (DiskAccessesGetPrivateLinkResourcesResponse, error) { req, err := client.getPrivateLinkResourcesCreateRequest(ctx, resourceGroupName, diskAccessName, options) if err != nil { - return PrivateLinkResourceListResultResponse{}, err + return DiskAccessesGetPrivateLinkResourcesResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return PrivateLinkResourceListResultResponse{}, err + return DiskAccessesGetPrivateLinkResourcesResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return PrivateLinkResourceListResultResponse{}, client.getPrivateLinkResourcesHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskAccessesGetPrivateLinkResourcesResponse{}, client.getPrivateLinkResourcesHandleError(resp) } return client.getPrivateLinkResourcesHandleResponse(resp) } // getPrivateLinkResourcesCreateRequest creates the GetPrivateLinkResources request. -func (client *DiskAccessesClient) getPrivateLinkResourcesCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesGetPrivateLinkResourcesOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) getPrivateLinkResourcesCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesGetPrivateLinkResourcesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateLinkResources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -518,116 +433,108 @@ func (client *DiskAccessesClient) getPrivateLinkResourcesCreateRequest(ctx conte return nil, errors.New("parameter diskAccessName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getPrivateLinkResourcesHandleResponse handles the GetPrivateLinkResources response. -func (client *DiskAccessesClient) getPrivateLinkResourcesHandleResponse(resp *azcore.Response) (PrivateLinkResourceListResultResponse, error) { - var val *PrivateLinkResourceListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return PrivateLinkResourceListResultResponse{}, err +func (client *DiskAccessesClient) getPrivateLinkResourcesHandleResponse(resp *http.Response) (DiskAccessesGetPrivateLinkResourcesResponse, error) { + result := DiskAccessesGetPrivateLinkResourcesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return DiskAccessesGetPrivateLinkResourcesResponse{}, err } - return PrivateLinkResourceListResultResponse{RawResponse: resp.Response, PrivateLinkResourceListResult: val}, nil + return result, nil } // getPrivateLinkResourcesHandleError handles the GetPrivateLinkResources error response. -func (client *DiskAccessesClient) getPrivateLinkResourcesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) getPrivateLinkResourcesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - Lists all the disk access resources under a subscription. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) List(options *DiskAccessesListOptions) DiskAccessListPager { - return &diskAccessListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DiskAccessesClient) List(options *DiskAccessesListOptions) *DiskAccessesListPager { + return &DiskAccessesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp DiskAccessListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.DiskAccessList.NextLink) + advancer: func(ctx context.Context, resp DiskAccessesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DiskAccessList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *DiskAccessesClient) listCreateRequest(ctx context.Context, options *DiskAccessesListOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) listCreateRequest(ctx context.Context, options *DiskAccessesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskAccesses" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *DiskAccessesClient) listHandleResponse(resp *azcore.Response) (DiskAccessListResponse, error) { - var val *DiskAccessList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskAccessListResponse{}, err +func (client *DiskAccessesClient) listHandleResponse(resp *http.Response) (DiskAccessesListResponse, error) { + result := DiskAccessesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskAccessList); err != nil { + return DiskAccessesListResponse{}, err } - return DiskAccessListResponse{RawResponse: resp.Response, DiskAccessList: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *DiskAccessesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListByResourceGroup - Lists all the disk access resources under a resource group. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) ListByResourceGroup(resourceGroupName string, options *DiskAccessesListByResourceGroupOptions) DiskAccessListPager { - return &diskAccessListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DiskAccessesClient) ListByResourceGroup(resourceGroupName string, options *DiskAccessesListByResourceGroupOptions) *DiskAccessesListByResourceGroupPager { + return &DiskAccessesListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listByResourceGroupHandleResponse, - errorer: client.listByResourceGroupHandleError, - advancer: func(ctx context.Context, resp DiskAccessListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.DiskAccessList.NextLink) + advancer: func(ctx context.Context, resp DiskAccessesListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DiskAccessList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *DiskAccessesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DiskAccessesListByResourceGroupOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DiskAccessesListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -637,59 +544,55 @@ func (client *DiskAccessesClient) listByResourceGroupCreateRequest(ctx context.C return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *DiskAccessesClient) listByResourceGroupHandleResponse(resp *azcore.Response) (DiskAccessListResponse, error) { - var val *DiskAccessList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskAccessListResponse{}, err +func (client *DiskAccessesClient) listByResourceGroupHandleResponse(resp *http.Response) (DiskAccessesListByResourceGroupResponse, error) { + result := DiskAccessesListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskAccessList); err != nil { + return DiskAccessesListByResourceGroupResponse{}, err } - return DiskAccessListResponse{RawResponse: resp.Response, DiskAccessList: val}, nil + return result, nil } // listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *DiskAccessesClient) listByResourceGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListPrivateEndpointConnections - List information about private endpoint connections under a disk access resource // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) ListPrivateEndpointConnections(resourceGroupName string, diskAccessName string, options *DiskAccessesListPrivateEndpointConnectionsOptions) PrivateEndpointConnectionListResultPager { - return &privateEndpointConnectionListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DiskAccessesClient) ListPrivateEndpointConnections(resourceGroupName string, diskAccessName string, options *DiskAccessesListPrivateEndpointConnectionsOptions) *DiskAccessesListPrivateEndpointConnectionsPager { + return &DiskAccessesListPrivateEndpointConnectionsPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listPrivateEndpointConnectionsCreateRequest(ctx, resourceGroupName, diskAccessName, options) }, - responder: client.listPrivateEndpointConnectionsHandleResponse, - errorer: client.listPrivateEndpointConnectionsHandleError, - advancer: func(ctx context.Context, resp PrivateEndpointConnectionListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionListResult.NextLink) + advancer: func(ctx context.Context, resp DiskAccessesListPrivateEndpointConnectionsResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.PrivateEndpointConnectionListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listPrivateEndpointConnectionsCreateRequest creates the ListPrivateEndpointConnections request. -func (client *DiskAccessesClient) listPrivateEndpointConnectionsCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesListPrivateEndpointConnectionsOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) listPrivateEndpointConnectionsCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, options *DiskAccessesListPrivateEndpointConnectionsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -703,107 +606,78 @@ func (client *DiskAccessesClient) listPrivateEndpointConnectionsCreateRequest(ct return nil, errors.New("parameter diskAccessName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listPrivateEndpointConnectionsHandleResponse handles the ListPrivateEndpointConnections response. -func (client *DiskAccessesClient) listPrivateEndpointConnectionsHandleResponse(resp *azcore.Response) (PrivateEndpointConnectionListResultResponse, error) { - var val *PrivateEndpointConnectionListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return PrivateEndpointConnectionListResultResponse{}, err +func (client *DiskAccessesClient) listPrivateEndpointConnectionsHandleResponse(resp *http.Response) (DiskAccessesListPrivateEndpointConnectionsResponse, error) { + result := DiskAccessesListPrivateEndpointConnectionsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return DiskAccessesListPrivateEndpointConnectionsResponse{}, err } - return PrivateEndpointConnectionListResultResponse{RawResponse: resp.Response, PrivateEndpointConnectionListResult: val}, nil + return result, nil } // listPrivateEndpointConnectionsHandleError handles the ListPrivateEndpointConnections error response. -func (client *DiskAccessesClient) listPrivateEndpointConnectionsHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) listPrivateEndpointConnectionsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - Updates (patches) a disk access resource. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesBeginUpdateOptions) (DiskAccessPollerResponse, error) { +func (client *DiskAccessesClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesBeginUpdateOptions) (DiskAccessesUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, diskAccessName, diskAccess, options) if err != nil { - return DiskAccessPollerResponse{}, err + return DiskAccessesUpdatePollerResponse{}, err } - result := DiskAccessPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("DiskAccessesClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return DiskAccessPollerResponse{}, err - } - poller := &diskAccessPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskAccessResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := DiskAccessesUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new DiskAccessPoller from the specified resume token. -// token - The value must come from a previous call to DiskAccessPoller.ResumeToken(). -func (client *DiskAccessesClient) ResumeUpdate(ctx context.Context, token string) (DiskAccessPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DiskAccessesClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("DiskAccessesClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return DiskAccessPollerResponse{}, err + return DiskAccessesUpdatePollerResponse{}, err } - poller := &diskAccessPoller{ + result.Poller = &DiskAccessesUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return DiskAccessPollerResponse{}, err - } - result := DiskAccessPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskAccessResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Updates (patches) a disk access resource. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) update(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesBeginUpdateOptions) (*azcore.Response, error) { +func (client *DiskAccessesClient) update(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, diskAccessName, diskAccess, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *DiskAccessesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesBeginUpdateOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, diskAccess DiskAccessUpdate, options *DiskAccessesBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -817,100 +691,71 @@ func (client *DiskAccessesClient) updateCreateRequest(ctx context.Context, resou return nil, errors.New("parameter diskAccessName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskAccessName}", url.PathEscape(diskAccessName)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(diskAccess) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, diskAccess) } // updateHandleError handles the Update error response. -func (client *DiskAccessesClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdateAPrivateEndpointConnection - Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new // private endpoint connection. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) BeginUpdateAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesBeginUpdateAPrivateEndpointConnectionOptions) (PrivateEndpointConnectionPollerResponse, error) { +func (client *DiskAccessesClient) BeginUpdateAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesBeginUpdateAPrivateEndpointConnectionOptions) (DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse, error) { resp, err := client.updateAPrivateEndpointConnection(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, options) if err != nil { - return PrivateEndpointConnectionPollerResponse{}, err - } - result := PrivateEndpointConnectionPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("DiskAccessesClient.UpdateAPrivateEndpointConnection", "", resp, client.con.Pipeline(), client.updateAPrivateEndpointConnectionHandleError) - if err != nil { - return PrivateEndpointConnectionPollerResponse{}, err - } - poller := &privateEndpointConnectionPoller{ - pt: pt, + return DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (PrivateEndpointConnectionResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdateAPrivateEndpointConnection creates a new PrivateEndpointConnectionPoller from the specified resume token. -// token - The value must come from a previous call to PrivateEndpointConnectionPoller.ResumeToken(). -func (client *DiskAccessesClient) ResumeUpdateAPrivateEndpointConnection(ctx context.Context, token string) (PrivateEndpointConnectionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DiskAccessesClient.UpdateAPrivateEndpointConnection", token, client.con.Pipeline(), client.updateAPrivateEndpointConnectionHandleError) + pt, err := armruntime.NewPoller("DiskAccessesClient.UpdateAPrivateEndpointConnection", "", resp, client.pl, client.updateAPrivateEndpointConnectionHandleError) if err != nil { - return PrivateEndpointConnectionPollerResponse{}, err + return DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse{}, err } - poller := &privateEndpointConnectionPoller{ + result.Poller = &DiskAccessesUpdateAPrivateEndpointConnectionPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return PrivateEndpointConnectionPollerResponse{}, err - } - result := PrivateEndpointConnectionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (PrivateEndpointConnectionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // UpdateAPrivateEndpointConnection - Approve or reject a private endpoint connection under disk access resource, this can't be used to create a new private // endpoint connection. // If the operation fails it returns the *CloudError error type. -func (client *DiskAccessesClient) updateAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesBeginUpdateAPrivateEndpointConnectionOptions) (*azcore.Response, error) { +func (client *DiskAccessesClient) updateAPrivateEndpointConnection(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesBeginUpdateAPrivateEndpointConnectionOptions) (*http.Response, error) { req, err := client.updateAPrivateEndpointConnectionCreateRequest(ctx, resourceGroupName, diskAccessName, privateEndpointConnectionName, privateEndpointConnection, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.updateAPrivateEndpointConnectionHandleError(resp) } return resp, nil } // updateAPrivateEndpointConnectionCreateRequest creates the UpdateAPrivateEndpointConnection request. -func (client *DiskAccessesClient) updateAPrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesBeginUpdateAPrivateEndpointConnectionOptions) (*azcore.Request, error) { +func (client *DiskAccessesClient) updateAPrivateEndpointConnectionCreateRequest(ctx context.Context, resourceGroupName string, diskAccessName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *DiskAccessesBeginUpdateAPrivateEndpointConnectionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskAccesses/{diskAccessName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -928,27 +773,26 @@ func (client *DiskAccessesClient) updateAPrivateEndpointConnectionCreateRequest( return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(privateEndpointConnection) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, privateEndpointConnection) } // updateAPrivateEndpointConnectionHandleError handles the UpdateAPrivateEndpointConnection error response. -func (client *DiskAccessesClient) updateAPrivateEndpointConnectionHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskAccessesClient) updateAPrivateEndpointConnectionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_diskencryptionsets_client.go b/sdk/compute/armcompute/zz_generated_diskencryptionsets_client.go index 33b0a944a673..1a05d802f336 100644 --- a/sdk/compute/armcompute/zz_generated_diskencryptionsets_client.go +++ b/sdk/compute/armcompute/zz_generated_diskencryptionsets_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // DiskEncryptionSetsClient contains the methods for the DiskEncryptionSets group. // Don't use this type directly, use NewDiskEncryptionSetsClient() instead. type DiskEncryptionSetsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewDiskEncryptionSetsClient creates a new instance of DiskEncryptionSetsClient with the specified values. -func NewDiskEncryptionSetsClient(con *armcore.Connection, subscriptionID string) *DiskEncryptionSetsClient { - return &DiskEncryptionSetsClient{con: con, subscriptionID: subscriptionID} +func NewDiskEncryptionSetsClient(con *arm.Connection, subscriptionID string) *DiskEncryptionSetsClient { + return &DiskEncryptionSetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Creates or updates a disk encryption set // If the operation fails it returns the *CloudError error type. -func (client *DiskEncryptionSetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsBeginCreateOrUpdateOptions) (DiskEncryptionSetPollerResponse, error) { +func (client *DiskEncryptionSetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsBeginCreateOrUpdateOptions) (DiskEncryptionSetsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options) if err != nil { - return DiskEncryptionSetPollerResponse{}, err - } - result := DiskEncryptionSetPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("DiskEncryptionSetsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return DiskEncryptionSetPollerResponse{}, err - } - poller := &diskEncryptionSetPoller{ - pt: pt, + return DiskEncryptionSetsCreateOrUpdatePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskEncryptionSetResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := DiskEncryptionSetsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeCreateOrUpdate creates a new DiskEncryptionSetPoller from the specified resume token. -// token - The value must come from a previous call to DiskEncryptionSetPoller.ResumeToken(). -func (client *DiskEncryptionSetsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (DiskEncryptionSetPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DiskEncryptionSetsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("DiskEncryptionSetsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return DiskEncryptionSetPollerResponse{}, err + return DiskEncryptionSetsCreateOrUpdatePollerResponse{}, err } - poller := &diskEncryptionSetPoller{ + result.Poller = &DiskEncryptionSetsCreateOrUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return DiskEncryptionSetPollerResponse{}, err - } - result := DiskEncryptionSetPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskEncryptionSetResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Creates or updates a disk encryption set // If the operation fails it returns the *CloudError error type. -func (client *DiskEncryptionSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *DiskEncryptionSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DiskEncryptionSetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *DiskEncryptionSetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSet, options *DiskEncryptionSetsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -111,98 +87,69 @@ func (client *DiskEncryptionSetsClient) createOrUpdateCreateRequest(ctx context. return nil, errors.New("parameter diskEncryptionSetName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskEncryptionSetName}", url.PathEscape(diskEncryptionSetName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(diskEncryptionSet) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, diskEncryptionSet) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *DiskEncryptionSetsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskEncryptionSetsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - Deletes a disk encryption set. // If the operation fails it returns the *CloudError error type. -func (client *DiskEncryptionSetsClient) BeginDelete(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *DiskEncryptionSetsClient) BeginDelete(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsBeginDeleteOptions) (DiskEncryptionSetsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, diskEncryptionSetName, options) if err != nil { - return HTTPPollerResponse{}, err + return DiskEncryptionSetsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := DiskEncryptionSetsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("DiskEncryptionSetsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("DiskEncryptionSetsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return DiskEncryptionSetsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &DiskEncryptionSetsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *DiskEncryptionSetsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DiskEncryptionSetsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Deletes a disk encryption set. // If the operation fails it returns the *CloudError error type. -func (client *DiskEncryptionSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsBeginDeleteOptions) (*azcore.Response, error) { +func (client *DiskEncryptionSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *DiskEncryptionSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsBeginDeleteOptions) (*azcore.Request, error) { +func (client *DiskEncryptionSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -216,50 +163,49 @@ func (client *DiskEncryptionSetsClient) deleteCreateRequest(ctx context.Context, return nil, errors.New("parameter diskEncryptionSetName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskEncryptionSetName}", url.PathEscape(diskEncryptionSetName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *DiskEncryptionSetsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskEncryptionSetsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - Gets information about a disk encryption set. // If the operation fails it returns the *CloudError error type. -func (client *DiskEncryptionSetsClient) Get(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsGetOptions) (DiskEncryptionSetResponse, error) { +func (client *DiskEncryptionSetsClient) Get(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsGetOptions) (DiskEncryptionSetsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, options) if err != nil { - return DiskEncryptionSetResponse{}, err + return DiskEncryptionSetsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return DiskEncryptionSetResponse{}, err + return DiskEncryptionSetsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return DiskEncryptionSetResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskEncryptionSetsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *DiskEncryptionSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsGetOptions) (*azcore.Request, error) { +func (client *DiskEncryptionSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -273,117 +219,109 @@ func (client *DiskEncryptionSetsClient) getCreateRequest(ctx context.Context, re return nil, errors.New("parameter diskEncryptionSetName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskEncryptionSetName}", url.PathEscape(diskEncryptionSetName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *DiskEncryptionSetsClient) getHandleResponse(resp *azcore.Response) (DiskEncryptionSetResponse, error) { - var val *DiskEncryptionSet - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskEncryptionSetResponse{}, err +func (client *DiskEncryptionSetsClient) getHandleResponse(resp *http.Response) (DiskEncryptionSetsGetResponse, error) { + result := DiskEncryptionSetsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskEncryptionSet); err != nil { + return DiskEncryptionSetsGetResponse{}, err } - return DiskEncryptionSetResponse{RawResponse: resp.Response, DiskEncryptionSet: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *DiskEncryptionSetsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskEncryptionSetsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - Lists all the disk encryption sets under a subscription. // If the operation fails it returns the *CloudError error type. -func (client *DiskEncryptionSetsClient) List(options *DiskEncryptionSetsListOptions) DiskEncryptionSetListPager { - return &diskEncryptionSetListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DiskEncryptionSetsClient) List(options *DiskEncryptionSetsListOptions) *DiskEncryptionSetsListPager { + return &DiskEncryptionSetsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp DiskEncryptionSetListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.DiskEncryptionSetList.NextLink) + advancer: func(ctx context.Context, resp DiskEncryptionSetsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DiskEncryptionSetList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *DiskEncryptionSetsClient) listCreateRequest(ctx context.Context, options *DiskEncryptionSetsListOptions) (*azcore.Request, error) { +func (client *DiskEncryptionSetsClient) listCreateRequest(ctx context.Context, options *DiskEncryptionSetsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/diskEncryptionSets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *DiskEncryptionSetsClient) listHandleResponse(resp *azcore.Response) (DiskEncryptionSetListResponse, error) { - var val *DiskEncryptionSetList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskEncryptionSetListResponse{}, err +func (client *DiskEncryptionSetsClient) listHandleResponse(resp *http.Response) (DiskEncryptionSetsListResponse, error) { + result := DiskEncryptionSetsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskEncryptionSetList); err != nil { + return DiskEncryptionSetsListResponse{}, err } - return DiskEncryptionSetListResponse{RawResponse: resp.Response, DiskEncryptionSetList: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *DiskEncryptionSetsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskEncryptionSetsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListAssociatedResources - Lists all resources that are encrypted with this disk encryption set. // If the operation fails it returns the *CloudError error type. -func (client *DiskEncryptionSetsClient) ListAssociatedResources(resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsListAssociatedResourcesOptions) ResourceURIListPager { - return &resourceURIListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DiskEncryptionSetsClient) ListAssociatedResources(resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsListAssociatedResourcesOptions) *DiskEncryptionSetsListAssociatedResourcesPager { + return &DiskEncryptionSetsListAssociatedResourcesPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listAssociatedResourcesCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, options) }, - responder: client.listAssociatedResourcesHandleResponse, - errorer: client.listAssociatedResourcesHandleError, - advancer: func(ctx context.Context, resp ResourceURIListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.ResourceURIList.NextLink) + advancer: func(ctx context.Context, resp DiskEncryptionSetsListAssociatedResourcesResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ResourceURIList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listAssociatedResourcesCreateRequest creates the ListAssociatedResources request. -func (client *DiskEncryptionSetsClient) listAssociatedResourcesCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsListAssociatedResourcesOptions) (*azcore.Request, error) { +func (client *DiskEncryptionSetsClient) listAssociatedResourcesCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, options *DiskEncryptionSetsListAssociatedResourcesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}/associatedResources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -397,59 +335,55 @@ func (client *DiskEncryptionSetsClient) listAssociatedResourcesCreateRequest(ctx return nil, errors.New("parameter diskEncryptionSetName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskEncryptionSetName}", url.PathEscape(diskEncryptionSetName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listAssociatedResourcesHandleResponse handles the ListAssociatedResources response. -func (client *DiskEncryptionSetsClient) listAssociatedResourcesHandleResponse(resp *azcore.Response) (ResourceURIListResponse, error) { - var val *ResourceURIList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ResourceURIListResponse{}, err +func (client *DiskEncryptionSetsClient) listAssociatedResourcesHandleResponse(resp *http.Response) (DiskEncryptionSetsListAssociatedResourcesResponse, error) { + result := DiskEncryptionSetsListAssociatedResourcesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceURIList); err != nil { + return DiskEncryptionSetsListAssociatedResourcesResponse{}, err } - return ResourceURIListResponse{RawResponse: resp.Response, ResourceURIList: val}, nil + return result, nil } // listAssociatedResourcesHandleError handles the ListAssociatedResources error response. -func (client *DiskEncryptionSetsClient) listAssociatedResourcesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskEncryptionSetsClient) listAssociatedResourcesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListByResourceGroup - Lists all the disk encryption sets under a resource group. // If the operation fails it returns the *CloudError error type. -func (client *DiskEncryptionSetsClient) ListByResourceGroup(resourceGroupName string, options *DiskEncryptionSetsListByResourceGroupOptions) DiskEncryptionSetListPager { - return &diskEncryptionSetListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DiskEncryptionSetsClient) ListByResourceGroup(resourceGroupName string, options *DiskEncryptionSetsListByResourceGroupOptions) *DiskEncryptionSetsListByResourceGroupPager { + return &DiskEncryptionSetsListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listByResourceGroupHandleResponse, - errorer: client.listByResourceGroupHandleError, - advancer: func(ctx context.Context, resp DiskEncryptionSetListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.DiskEncryptionSetList.NextLink) + advancer: func(ctx context.Context, resp DiskEncryptionSetsListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DiskEncryptionSetList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *DiskEncryptionSetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DiskEncryptionSetsListByResourceGroupOptions) (*azcore.Request, error) { +func (client *DiskEncryptionSetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DiskEncryptionSetsListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -459,107 +393,78 @@ func (client *DiskEncryptionSetsClient) listByResourceGroupCreateRequest(ctx con return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *DiskEncryptionSetsClient) listByResourceGroupHandleResponse(resp *azcore.Response) (DiskEncryptionSetListResponse, error) { - var val *DiskEncryptionSetList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskEncryptionSetListResponse{}, err +func (client *DiskEncryptionSetsClient) listByResourceGroupHandleResponse(resp *http.Response) (DiskEncryptionSetsListByResourceGroupResponse, error) { + result := DiskEncryptionSetsListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskEncryptionSetList); err != nil { + return DiskEncryptionSetsListByResourceGroupResponse{}, err } - return DiskEncryptionSetListResponse{RawResponse: resp.Response, DiskEncryptionSetList: val}, nil + return result, nil } // listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *DiskEncryptionSetsClient) listByResourceGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskEncryptionSetsClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - Updates (patches) a disk encryption set. // If the operation fails it returns the *CloudError error type. -func (client *DiskEncryptionSetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsBeginUpdateOptions) (DiskEncryptionSetPollerResponse, error) { +func (client *DiskEncryptionSetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsBeginUpdateOptions) (DiskEncryptionSetsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options) if err != nil { - return DiskEncryptionSetPollerResponse{}, err - } - result := DiskEncryptionSetPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("DiskEncryptionSetsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return DiskEncryptionSetPollerResponse{}, err + return DiskEncryptionSetsUpdatePollerResponse{}, err } - poller := &diskEncryptionSetPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskEncryptionSetResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := DiskEncryptionSetsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new DiskEncryptionSetPoller from the specified resume token. -// token - The value must come from a previous call to DiskEncryptionSetPoller.ResumeToken(). -func (client *DiskEncryptionSetsClient) ResumeUpdate(ctx context.Context, token string) (DiskEncryptionSetPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DiskEncryptionSetsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("DiskEncryptionSetsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return DiskEncryptionSetPollerResponse{}, err + return DiskEncryptionSetsUpdatePollerResponse{}, err } - poller := &diskEncryptionSetPoller{ + result.Poller = &DiskEncryptionSetsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return DiskEncryptionSetPollerResponse{}, err - } - result := DiskEncryptionSetPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskEncryptionSetResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Updates (patches) a disk encryption set. // If the operation fails it returns the *CloudError error type. -func (client *DiskEncryptionSetsClient) update(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsBeginUpdateOptions) (*azcore.Response, error) { +func (client *DiskEncryptionSetsClient) update(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, diskEncryptionSetName, diskEncryptionSet, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *DiskEncryptionSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsBeginUpdateOptions) (*azcore.Request, error) { +func (client *DiskEncryptionSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskEncryptionSetName string, diskEncryptionSet DiskEncryptionSetUpdate, options *DiskEncryptionSetsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/diskEncryptionSets/{diskEncryptionSetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -573,27 +478,26 @@ func (client *DiskEncryptionSetsClient) updateCreateRequest(ctx context.Context, return nil, errors.New("parameter diskEncryptionSetName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskEncryptionSetName}", url.PathEscape(diskEncryptionSetName)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(diskEncryptionSet) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, diskEncryptionSet) } // updateHandleError handles the Update error response. -func (client *DiskEncryptionSetsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskEncryptionSetsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_diskrestorepoint_client.go b/sdk/compute/armcompute/zz_generated_diskrestorepoint_client.go index 138580c74798..153bb9200459 100644 --- a/sdk/compute/armcompute/zz_generated_diskrestorepoint_client.go +++ b/sdk/compute/armcompute/zz_generated_diskrestorepoint_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,44 +12,48 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // DiskRestorePointClient contains the methods for the DiskRestorePoint group. // Don't use this type directly, use NewDiskRestorePointClient() instead. type DiskRestorePointClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewDiskRestorePointClient creates a new instance of DiskRestorePointClient with the specified values. -func NewDiskRestorePointClient(con *armcore.Connection, subscriptionID string) *DiskRestorePointClient { - return &DiskRestorePointClient{con: con, subscriptionID: subscriptionID} +func NewDiskRestorePointClient(con *arm.Connection, subscriptionID string) *DiskRestorePointClient { + return &DiskRestorePointClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // Get - Get disk restorePoint resource // If the operation fails it returns the *CloudError error type. -func (client *DiskRestorePointClient) Get(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointGetOptions) (DiskRestorePointResponse, error) { +func (client *DiskRestorePointClient) Get(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointGetOptions) (DiskRestorePointGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, options) if err != nil { - return DiskRestorePointResponse{}, err + return DiskRestorePointGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return DiskRestorePointResponse{}, err + return DiskRestorePointGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return DiskRestorePointResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DiskRestorePointGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *DiskRestorePointClient) getCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointGetOptions) (*azcore.Request, error) { +func (client *DiskRestorePointClient) getCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -70,59 +75,139 @@ func (client *DiskRestorePointClient) getCreateRequest(ctx context.Context, reso return nil, errors.New("parameter diskRestorePointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskRestorePointName}", url.PathEscape(diskRestorePointName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *DiskRestorePointClient) getHandleResponse(resp *azcore.Response) (DiskRestorePointResponse, error) { - var val *DiskRestorePoint - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskRestorePointResponse{}, err +func (client *DiskRestorePointClient) getHandleResponse(resp *http.Response) (DiskRestorePointGetResponse, error) { + result := DiskRestorePointGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskRestorePoint); err != nil { + return DiskRestorePointGetResponse{}, err } - return DiskRestorePointResponse{RawResponse: resp.Response, DiskRestorePoint: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *DiskRestorePointClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskRestorePointClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginGrantAccess - Grants access to a diskRestorePoint. +// If the operation fails it returns the *CloudError error type. +func (client *DiskRestorePointClient) BeginGrantAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, grantAccessData GrantAccessData, options *DiskRestorePointBeginGrantAccessOptions) (DiskRestorePointGrantAccessPollerResponse, error) { + resp, err := client.grantAccess(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, options) + if err != nil { + return DiskRestorePointGrantAccessPollerResponse{}, err + } + result := DiskRestorePointGrantAccessPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DiskRestorePointClient.GrantAccess", "location", resp, client.pl, client.grantAccessHandleError) + if err != nil { + return DiskRestorePointGrantAccessPollerResponse{}, err + } + result.Poller = &DiskRestorePointGrantAccessPoller{ + pt: pt, + } + return result, nil +} + +// GrantAccess - Grants access to a diskRestorePoint. +// If the operation fails it returns the *CloudError error type. +func (client *DiskRestorePointClient) grantAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, grantAccessData GrantAccessData, options *DiskRestorePointBeginGrantAccessOptions) (*http.Response, error) { + req, err := client.grantAccessCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, grantAccessData, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.grantAccessHandleError(resp) + } + return resp, nil +} + +// grantAccessCreateRequest creates the GrantAccess request. +func (client *DiskRestorePointClient) grantAccessCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, grantAccessData GrantAccessData, options *DiskRestorePointBeginGrantAccessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/beginGetAccess" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + if vmRestorePointName == "" { + return nil, errors.New("parameter vmRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmRestorePointName}", url.PathEscape(vmRestorePointName)) + if diskRestorePointName == "" { + return nil, errors.New("parameter diskRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskRestorePointName}", url.PathEscape(diskRestorePointName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, grantAccessData) +} + +// grantAccessHandleError handles the GrantAccess error response. +func (client *DiskRestorePointClient) grantAccessHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListByRestorePoint - Lists diskRestorePoints under a vmRestorePoint. // If the operation fails it returns the *CloudError error type. -func (client *DiskRestorePointClient) ListByRestorePoint(resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, options *DiskRestorePointListByRestorePointOptions) DiskRestorePointListPager { - return &diskRestorePointListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DiskRestorePointClient) ListByRestorePoint(resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, options *DiskRestorePointListByRestorePointOptions) *DiskRestorePointListByRestorePointPager { + return &DiskRestorePointListByRestorePointPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByRestorePointCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, options) }, - responder: client.listByRestorePointHandleResponse, - errorer: client.listByRestorePointHandleError, - advancer: func(ctx context.Context, resp DiskRestorePointListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.DiskRestorePointList.NextLink) + advancer: func(ctx context.Context, resp DiskRestorePointListByRestorePointResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DiskRestorePointList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByRestorePointCreateRequest creates the ListByRestorePoint request. -func (client *DiskRestorePointClient) listByRestorePointCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, options *DiskRestorePointListByRestorePointOptions) (*azcore.Request, error) { +func (client *DiskRestorePointClient) listByRestorePointCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, options *DiskRestorePointListByRestorePointOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -140,36 +225,119 @@ func (client *DiskRestorePointClient) listByRestorePointCreateRequest(ctx contex return nil, errors.New("parameter vmRestorePointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{vmRestorePointName}", url.PathEscape(vmRestorePointName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByRestorePointHandleResponse handles the ListByRestorePoint response. -func (client *DiskRestorePointClient) listByRestorePointHandleResponse(resp *azcore.Response) (DiskRestorePointListResponse, error) { - var val *DiskRestorePointList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskRestorePointListResponse{}, err +func (client *DiskRestorePointClient) listByRestorePointHandleResponse(resp *http.Response) (DiskRestorePointListByRestorePointResponse, error) { + result := DiskRestorePointListByRestorePointResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskRestorePointList); err != nil { + return DiskRestorePointListByRestorePointResponse{}, err } - return DiskRestorePointListResponse{RawResponse: resp.Response, DiskRestorePointList: val}, nil + return result, nil } // listByRestorePointHandleError handles the ListByRestorePoint error response. -func (client *DiskRestorePointClient) listByRestorePointHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DiskRestorePointClient) listByRestorePointHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginRevokeAccess - Revokes access to a diskRestorePoint. +// If the operation fails it returns the *CloudError error type. +func (client *DiskRestorePointClient) BeginRevokeAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointBeginRevokeAccessOptions) (DiskRestorePointRevokeAccessPollerResponse, error) { + resp, err := client.revokeAccess(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, options) + if err != nil { + return DiskRestorePointRevokeAccessPollerResponse{}, err + } + result := DiskRestorePointRevokeAccessPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DiskRestorePointClient.RevokeAccess", "location", resp, client.pl, client.revokeAccessHandleError) + if err != nil { + return DiskRestorePointRevokeAccessPollerResponse{}, err + } + result.Poller = &DiskRestorePointRevokeAccessPoller{ + pt: pt, + } + return result, nil +} + +// RevokeAccess - Revokes access to a diskRestorePoint. +// If the operation fails it returns the *CloudError error type. +func (client *DiskRestorePointClient) revokeAccess(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointBeginRevokeAccessOptions) (*http.Response, error) { + req, err := client.revokeAccessCreateRequest(ctx, resourceGroupName, restorePointCollectionName, vmRestorePointName, diskRestorePointName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.revokeAccessHandleError(resp) + } + return resp, nil +} + +// revokeAccessCreateRequest creates the RevokeAccess request. +func (client *DiskRestorePointClient) revokeAccessCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, vmRestorePointName string, diskRestorePointName string, options *DiskRestorePointBeginRevokeAccessOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{vmRestorePointName}/diskRestorePoints/{diskRestorePointName}/endGetAccess" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if restorePointCollectionName == "" { + return nil, errors.New("parameter restorePointCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) + if vmRestorePointName == "" { + return nil, errors.New("parameter vmRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmRestorePointName}", url.PathEscape(vmRestorePointName)) + if diskRestorePointName == "" { + return nil, errors.New("parameter diskRestorePointName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{diskRestorePointName}", url.PathEscape(diskRestorePointName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2020-12-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// revokeAccessHandleError handles the RevokeAccess error response. +func (client *DiskRestorePointClient) revokeAccessHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_disks_client.go b/sdk/compute/armcompute/zz_generated_disks_client.go index b9784aee6bc0..6c4108250d34 100644 --- a/sdk/compute/armcompute/zz_generated_disks_client.go +++ b/sdk/compute/armcompute/zz_generated_disks_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,93 +11,68 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // DisksClient contains the methods for the Disks group. // Don't use this type directly, use NewDisksClient() instead. type DisksClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewDisksClient creates a new instance of DisksClient with the specified values. -func NewDisksClient(con *armcore.Connection, subscriptionID string) *DisksClient { - return &DisksClient{con: con, subscriptionID: subscriptionID} +func NewDisksClient(con *arm.Connection, subscriptionID string) *DisksClient { + return &DisksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Creates or updates a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksBeginCreateOrUpdateOptions) (DiskPollerResponse, error) { +func (client *DisksClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksBeginCreateOrUpdateOptions) (DisksCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, diskName, disk, options) if err != nil { - return DiskPollerResponse{}, err + return DisksCreateOrUpdatePollerResponse{}, err } - result := DiskPollerResponse{ - RawResponse: resp.Response, + result := DisksCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("DisksClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("DisksClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return DiskPollerResponse{}, err + return DisksCreateOrUpdatePollerResponse{}, err } - poller := &diskPoller{ + result.Poller = &DisksCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new DiskPoller from the specified resume token. -// token - The value must come from a previous call to DiskPoller.ResumeToken(). -func (client *DisksClient) ResumeCreateOrUpdate(ctx context.Context, token string) (DiskPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DisksClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return DiskPollerResponse{}, err - } - poller := &diskPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return DiskPollerResponse{}, err - } - result := DiskPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Creates or updates a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *DisksClient) createOrUpdate(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, diskName, disk, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DisksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *DisksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, diskName string, disk Disk, options *DisksBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -110,97 +86,68 @@ func (client *DisksClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, errors.New("parameter diskName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(disk) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, disk) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *DisksClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DisksClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDelete - Deletes a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) BeginDelete(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *DisksClient) BeginDelete(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginDeleteOptions) (DisksDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, diskName, options) if err != nil { - return HTTPPollerResponse{}, err + return DisksDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("DisksClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := DisksDeletePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *DisksClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DisksClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("DisksClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return DisksDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &DisksDeletePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Deletes a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) deleteOperation(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginDeleteOptions) (*azcore.Response, error) { +func (client *DisksClient) deleteOperation(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, diskName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *DisksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginDeleteOptions) (*azcore.Request, error) { +func (client *DisksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -214,48 +161,47 @@ func (client *DisksClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, errors.New("parameter diskName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *DisksClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DisksClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Gets information about a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string, options *DisksGetOptions) (DiskResponse, error) { +func (client *DisksClient) Get(ctx context.Context, resourceGroupName string, diskName string, options *DisksGetOptions) (DisksGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, diskName, options) if err != nil { - return DiskResponse{}, err + return DisksGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return DiskResponse{}, err + return DisksGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return DiskResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return DisksGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *DisksClient) getCreateRequest(ctx context.Context, resourceGroupName string, diskName string, options *DisksGetOptions) (*azcore.Request, error) { +func (client *DisksClient) getCreateRequest(ctx context.Context, resourceGroupName string, diskName string, options *DisksGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -269,106 +215,77 @@ func (client *DisksClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, errors.New("parameter diskName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *DisksClient) getHandleResponse(resp *azcore.Response) (DiskResponse, error) { - var val *Disk - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskResponse{}, err +func (client *DisksClient) getHandleResponse(resp *http.Response) (DisksGetResponse, error) { + result := DisksGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Disk); err != nil { + return DisksGetResponse{}, err } - return DiskResponse{RawResponse: resp.Response, Disk: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *DisksClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DisksClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginGrantAccess - Grants access to a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) BeginGrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksBeginGrantAccessOptions) (AccessURIPollerResponse, error) { +func (client *DisksClient) BeginGrantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksBeginGrantAccessOptions) (DisksGrantAccessPollerResponse, error) { resp, err := client.grantAccess(ctx, resourceGroupName, diskName, grantAccessData, options) if err != nil { - return AccessURIPollerResponse{}, err - } - result := AccessURIPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("DisksClient.GrantAccess", "location", resp, client.con.Pipeline(), client.grantAccessHandleError) - if err != nil { - return AccessURIPollerResponse{}, err + return DisksGrantAccessPollerResponse{}, err } - poller := &accessURIPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (AccessURIResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := DisksGrantAccessPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeGrantAccess creates a new AccessURIPoller from the specified resume token. -// token - The value must come from a previous call to AccessURIPoller.ResumeToken(). -func (client *DisksClient) ResumeGrantAccess(ctx context.Context, token string) (AccessURIPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DisksClient.GrantAccess", token, client.con.Pipeline(), client.grantAccessHandleError) + pt, err := armruntime.NewPoller("DisksClient.GrantAccess", "location", resp, client.pl, client.grantAccessHandleError) if err != nil { - return AccessURIPollerResponse{}, err + return DisksGrantAccessPollerResponse{}, err } - poller := &accessURIPoller{ + result.Poller = &DisksGrantAccessPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return AccessURIPollerResponse{}, err - } - result := AccessURIPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (AccessURIResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // GrantAccess - Grants access to a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) grantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksBeginGrantAccessOptions) (*azcore.Response, error) { +func (client *DisksClient) grantAccess(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksBeginGrantAccessOptions) (*http.Response, error) { req, err := client.grantAccessCreateRequest(ctx, resourceGroupName, diskName, grantAccessData, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.grantAccessHandleError(resp) } return resp, nil } // grantAccessCreateRequest creates the GrantAccess request. -func (client *DisksClient) grantAccessCreateRequest(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksBeginGrantAccessOptions) (*azcore.Request, error) { +func (client *DisksClient) grantAccessCreateRequest(ctx context.Context, resourceGroupName string, diskName string, grantAccessData GrantAccessData, options *DisksBeginGrantAccessOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/beginGetAccess" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -382,106 +299,98 @@ func (client *DisksClient) grantAccessCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter diskName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(grantAccessData) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, grantAccessData) } // grantAccessHandleError handles the GrantAccess error response. -func (client *DisksClient) grantAccessHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DisksClient) grantAccessHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - Lists all the disks under a subscription. // If the operation fails it returns a generic error. -func (client *DisksClient) List(options *DisksListOptions) DiskListPager { - return &diskListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DisksClient) List(options *DisksListOptions) *DisksListPager { + return &DisksListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp DiskListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.DiskList.NextLink) + advancer: func(ctx context.Context, resp DisksListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DiskList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *DisksClient) listCreateRequest(ctx context.Context, options *DisksListOptions) (*azcore.Request, error) { +func (client *DisksClient) listCreateRequest(ctx context.Context, options *DisksListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/disks" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *DisksClient) listHandleResponse(resp *azcore.Response) (DiskListResponse, error) { - var val *DiskList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskListResponse{}, err +func (client *DisksClient) listHandleResponse(resp *http.Response) (DisksListResponse, error) { + result := DisksListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskList); err != nil { + return DisksListResponse{}, err } - return DiskListResponse{RawResponse: resp.Response, DiskList: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *DisksClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DisksClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListByResourceGroup - Lists all the disks under a resource group. // If the operation fails it returns a generic error. -func (client *DisksClient) ListByResourceGroup(resourceGroupName string, options *DisksListByResourceGroupOptions) DiskListPager { - return &diskListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *DisksClient) ListByResourceGroup(resourceGroupName string, options *DisksListByResourceGroupOptions) *DisksListByResourceGroupPager { + return &DisksListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listByResourceGroupHandleResponse, - errorer: client.listByResourceGroupHandleError, - advancer: func(ctx context.Context, resp DiskListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.DiskList.NextLink) + advancer: func(ctx context.Context, resp DisksListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.DiskList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *DisksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DisksListByResourceGroupOptions) (*azcore.Request, error) { +func (client *DisksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DisksListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -491,106 +400,77 @@ func (client *DisksClient) listByResourceGroupCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *DisksClient) listByResourceGroupHandleResponse(resp *azcore.Response) (DiskListResponse, error) { - var val *DiskList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return DiskListResponse{}, err +func (client *DisksClient) listByResourceGroupHandleResponse(resp *http.Response) (DisksListByResourceGroupResponse, error) { + result := DisksListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.DiskList); err != nil { + return DisksListByResourceGroupResponse{}, err } - return DiskListResponse{RawResponse: resp.Response, DiskList: val}, nil + return result, nil } // listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *DisksClient) listByResourceGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DisksClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginRevokeAccess - Revokes access to a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) BeginRevokeAccess(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginRevokeAccessOptions) (HTTPPollerResponse, error) { +func (client *DisksClient) BeginRevokeAccess(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginRevokeAccessOptions) (DisksRevokeAccessPollerResponse, error) { resp, err := client.revokeAccess(ctx, resourceGroupName, diskName, options) if err != nil { - return HTTPPollerResponse{}, err + return DisksRevokeAccessPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := DisksRevokeAccessPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("DisksClient.RevokeAccess", "location", resp, client.con.Pipeline(), client.revokeAccessHandleError) + pt, err := armruntime.NewPoller("DisksClient.RevokeAccess", "location", resp, client.pl, client.revokeAccessHandleError) if err != nil { - return HTTPPollerResponse{}, err + return DisksRevokeAccessPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &DisksRevokeAccessPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeRevokeAccess creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *DisksClient) ResumeRevokeAccess(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DisksClient.RevokeAccess", token, client.con.Pipeline(), client.revokeAccessHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // RevokeAccess - Revokes access to a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) revokeAccess(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginRevokeAccessOptions) (*azcore.Response, error) { +func (client *DisksClient) revokeAccess(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginRevokeAccessOptions) (*http.Response, error) { req, err := client.revokeAccessCreateRequest(ctx, resourceGroupName, diskName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.revokeAccessHandleError(resp) } return resp, nil } // revokeAccessCreateRequest creates the RevokeAccess request. -func (client *DisksClient) revokeAccessCreateRequest(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginRevokeAccessOptions) (*azcore.Request, error) { +func (client *DisksClient) revokeAccessCreateRequest(ctx context.Context, resourceGroupName string, diskName string, options *DisksBeginRevokeAccessOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}/endGetAccess" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -604,96 +484,67 @@ func (client *DisksClient) revokeAccessCreateRequest(ctx context.Context, resour return nil, errors.New("parameter diskName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // revokeAccessHandleError handles the RevokeAccess error response. -func (client *DisksClient) revokeAccessHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DisksClient) revokeAccessHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginUpdate - Updates (patches) a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksBeginUpdateOptions) (DiskPollerResponse, error) { +func (client *DisksClient) BeginUpdate(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksBeginUpdateOptions) (DisksUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, diskName, disk, options) if err != nil { - return DiskPollerResponse{}, err - } - result := DiskPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("DisksClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return DiskPollerResponse{}, err - } - poller := &diskPoller{ - pt: pt, + return DisksUpdatePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := DisksUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new DiskPoller from the specified resume token. -// token - The value must come from a previous call to DiskPoller.ResumeToken(). -func (client *DisksClient) ResumeUpdate(ctx context.Context, token string) (DiskPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("DisksClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("DisksClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return DiskPollerResponse{}, err + return DisksUpdatePollerResponse{}, err } - poller := &diskPoller{ + result.Poller = &DisksUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return DiskPollerResponse{}, err - } - result := DiskPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (DiskResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Updates (patches) a disk. // If the operation fails it returns a generic error. -func (client *DisksClient) update(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksBeginUpdateOptions) (*azcore.Response, error) { +func (client *DisksClient) update(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, diskName, disk, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *DisksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksBeginUpdateOptions) (*azcore.Request, error) { +func (client *DisksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, diskName string, disk DiskUpdate, options *DisksBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/disks/{diskName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -707,26 +558,25 @@ func (client *DisksClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, errors.New("parameter diskName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{diskName}", url.PathEscape(diskName)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(disk) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, disk) } // updateHandleError handles the Update error response. -func (client *DisksClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *DisksClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_galleries_client.go b/sdk/compute/armcompute/zz_generated_galleries_client.go index e9064d017846..49d9fc3827d7 100644 --- a/sdk/compute/armcompute/zz_generated_galleries_client.go +++ b/sdk/compute/armcompute/zz_generated_galleries_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GalleriesClient contains the methods for the Galleries group. // Don't use this type directly, use NewGalleriesClient() instead. type GalleriesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewGalleriesClient creates a new instance of GalleriesClient with the specified values. -func NewGalleriesClient(con *armcore.Connection, subscriptionID string) *GalleriesClient { - return &GalleriesClient{con: con, subscriptionID: subscriptionID} +func NewGalleriesClient(con *arm.Connection, subscriptionID string) *GalleriesClient { + return &GalleriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Create or update a Shared Image Gallery. // If the operation fails it returns the *CloudError error type. -func (client *GalleriesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesBeginCreateOrUpdateOptions) (GalleryPollerResponse, error) { +func (client *GalleriesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesBeginCreateOrUpdateOptions) (GalleriesCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryName, gallery, options) if err != nil { - return GalleryPollerResponse{}, err + return GalleriesCreateOrUpdatePollerResponse{}, err } - result := GalleryPollerResponse{ - RawResponse: resp.Response, + result := GalleriesCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("GalleriesClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("GalleriesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return GalleryPollerResponse{}, err + return GalleriesCreateOrUpdatePollerResponse{}, err } - poller := &galleryPoller{ + result.Poller = &GalleriesCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new GalleryPoller from the specified resume token. -// token - The value must come from a previous call to GalleryPoller.ResumeToken(). -func (client *GalleriesClient) ResumeCreateOrUpdate(ctx context.Context, token string) (GalleryPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleriesClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return GalleryPollerResponse{}, err - } - poller := &galleryPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return GalleryPollerResponse{}, err - } - result := GalleryPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Create or update a Shared Image Gallery. // If the operation fails it returns the *CloudError error type. -func (client *GalleriesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *GalleriesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, gallery, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, gallery Gallery, options *GalleriesBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -111,98 +87,69 @@ func (client *GalleriesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(gallery) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, gallery) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *GalleriesClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleriesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - Delete a Shared Image Gallery. // If the operation fails it returns the *CloudError error type. -func (client *GalleriesClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *GalleriesClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesBeginDeleteOptions) (GalleriesDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, galleryName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("GalleriesClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return GalleriesDeletePollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := GalleriesDeletePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *GalleriesClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleriesClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("GalleriesClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return GalleriesDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &GalleriesDeletePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Delete a Shared Image Gallery. // If the operation fails it returns the *CloudError error type. -func (client *GalleriesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesBeginDeleteOptions) (*azcore.Response, error) { +func (client *GalleriesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesBeginDeleteOptions) (*azcore.Request, error) { +func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -216,50 +163,49 @@ func (client *GalleriesClient) deleteCreateRequest(ctx context.Context, resource return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *GalleriesClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleriesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - Retrieves information about a Shared Image Gallery. // If the operation fails it returns the *CloudError error type. -func (client *GalleriesClient) Get(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesGetOptions) (GalleryResponse, error) { +func (client *GalleriesClient) Get(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesGetOptions) (GalleriesGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, options) if err != nil { - return GalleryResponse{}, err + return GalleriesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return GalleryResponse{}, err + return GalleriesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return GalleryResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleriesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *GalleriesClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesGetOptions) (*azcore.Request, error) { +func (client *GalleriesClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleriesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -273,120 +219,112 @@ func (client *GalleriesClient) getCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") if options != nil && options.Select != nil { reqQP.Set("$select", string(*options.Select)) } - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *GalleriesClient) getHandleResponse(resp *azcore.Response) (GalleryResponse, error) { - var val *Gallery - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryResponse{}, err +func (client *GalleriesClient) getHandleResponse(resp *http.Response) (GalleriesGetResponse, error) { + result := GalleriesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Gallery); err != nil { + return GalleriesGetResponse{}, err } - return GalleryResponse{RawResponse: resp.Response, Gallery: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *GalleriesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleriesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - List galleries under a subscription. // If the operation fails it returns the *CloudError error type. -func (client *GalleriesClient) List(options *GalleriesListOptions) GalleryListPager { - return &galleryListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *GalleriesClient) List(options *GalleriesListOptions) *GalleriesListPager { + return &GalleriesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp GalleryListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.GalleryList.NextLink) + advancer: func(ctx context.Context, resp GalleriesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.GalleryList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *GalleriesClient) listCreateRequest(ctx context.Context, options *GalleriesListOptions) (*azcore.Request, error) { +func (client *GalleriesClient) listCreateRequest(ctx context.Context, options *GalleriesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/galleries" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *GalleriesClient) listHandleResponse(resp *azcore.Response) (GalleryListResponse, error) { - var val *GalleryList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryListResponse{}, err +func (client *GalleriesClient) listHandleResponse(resp *http.Response) (GalleriesListResponse, error) { + result := GalleriesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryList); err != nil { + return GalleriesListResponse{}, err } - return GalleryListResponse{RawResponse: resp.Response, GalleryList: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *GalleriesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleriesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListByResourceGroup - List galleries under a resource group. // If the operation fails it returns the *CloudError error type. -func (client *GalleriesClient) ListByResourceGroup(resourceGroupName string, options *GalleriesListByResourceGroupOptions) GalleryListPager { - return &galleryListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *GalleriesClient) ListByResourceGroup(resourceGroupName string, options *GalleriesListByResourceGroupOptions) *GalleriesListByResourceGroupPager { + return &GalleriesListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listByResourceGroupHandleResponse, - errorer: client.listByResourceGroupHandleError, - advancer: func(ctx context.Context, resp GalleryListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.GalleryList.NextLink) + advancer: func(ctx context.Context, resp GalleriesListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.GalleryList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *GalleriesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *GalleriesListByResourceGroupOptions) (*azcore.Request, error) { +func (client *GalleriesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *GalleriesListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -396,107 +334,78 @@ func (client *GalleriesClient) listByResourceGroupCreateRequest(ctx context.Cont return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *GalleriesClient) listByResourceGroupHandleResponse(resp *azcore.Response) (GalleryListResponse, error) { - var val *GalleryList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryListResponse{}, err +func (client *GalleriesClient) listByResourceGroupHandleResponse(resp *http.Response) (GalleriesListByResourceGroupResponse, error) { + result := GalleriesListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryList); err != nil { + return GalleriesListByResourceGroupResponse{}, err } - return GalleryListResponse{RawResponse: resp.Response, GalleryList: val}, nil + return result, nil } // listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *GalleriesClient) listByResourceGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleriesClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - Update a Shared Image Gallery. // If the operation fails it returns the *CloudError error type. -func (client *GalleriesClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesBeginUpdateOptions) (GalleryPollerResponse, error) { +func (client *GalleriesClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesBeginUpdateOptions) (GalleriesUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, galleryName, gallery, options) if err != nil { - return GalleryPollerResponse{}, err - } - result := GalleryPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("GalleriesClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return GalleryPollerResponse{}, err + return GalleriesUpdatePollerResponse{}, err } - poller := &galleryPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := GalleriesUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new GalleryPoller from the specified resume token. -// token - The value must come from a previous call to GalleryPoller.ResumeToken(). -func (client *GalleriesClient) ResumeUpdate(ctx context.Context, token string) (GalleryPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleriesClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("GalleriesClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return GalleryPollerResponse{}, err + return GalleriesUpdatePollerResponse{}, err } - poller := &galleryPoller{ + result.Poller = &GalleriesUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return GalleryPollerResponse{}, err - } - result := GalleryPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Update a Shared Image Gallery. // If the operation fails it returns the *CloudError error type. -func (client *GalleriesClient) update(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesBeginUpdateOptions) (*azcore.Response, error) { +func (client *GalleriesClient) update(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, gallery, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *GalleriesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesBeginUpdateOptions) (*azcore.Request, error) { +func (client *GalleriesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, gallery GalleryUpdate, options *GalleriesBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -510,27 +419,26 @@ func (client *GalleriesClient) updateCreateRequest(ctx context.Context, resource return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(gallery) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, gallery) } // updateHandleError handles the Update error response. -func (client *GalleriesClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleriesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_galleryapplications_client.go b/sdk/compute/armcompute/zz_generated_galleryapplications_client.go index d391016710b9..4f150462736b 100644 --- a/sdk/compute/armcompute/zz_generated_galleryapplications_client.go +++ b/sdk/compute/armcompute/zz_generated_galleryapplications_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GalleryApplicationsClient contains the methods for the GalleryApplications group. // Don't use this type directly, use NewGalleryApplicationsClient() instead. type GalleryApplicationsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewGalleryApplicationsClient creates a new instance of GalleryApplicationsClient with the specified values. -func NewGalleryApplicationsClient(con *armcore.Connection, subscriptionID string) *GalleryApplicationsClient { - return &GalleryApplicationsClient{con: con, subscriptionID: subscriptionID} +func NewGalleryApplicationsClient(con *arm.Connection, subscriptionID string) *GalleryApplicationsClient { + return &GalleryApplicationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Create or update a gallery Application Definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsBeginCreateOrUpdateOptions) (GalleryApplicationPollerResponse, error) { +func (client *GalleryApplicationsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsBeginCreateOrUpdateOptions) (GalleryApplicationsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) if err != nil { - return GalleryApplicationPollerResponse{}, err + return GalleryApplicationsCreateOrUpdatePollerResponse{}, err } - result := GalleryApplicationPollerResponse{ - RawResponse: resp.Response, + result := GalleryApplicationsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("GalleryApplicationsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("GalleryApplicationsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return GalleryApplicationPollerResponse{}, err + return GalleryApplicationsCreateOrUpdatePollerResponse{}, err } - poller := &galleryApplicationPoller{ + result.Poller = &GalleryApplicationsCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryApplicationResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new GalleryApplicationPoller from the specified resume token. -// token - The value must come from a previous call to GalleryApplicationPoller.ResumeToken(). -func (client *GalleryApplicationsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (GalleryApplicationPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryApplicationsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return GalleryApplicationPollerResponse{}, err - } - poller := &galleryApplicationPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return GalleryApplicationPollerResponse{}, err - } - result := GalleryApplicationPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryApplicationResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Create or update a gallery Application Definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *GalleryApplicationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GalleryApplicationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *GalleryApplicationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplication, options *GalleryApplicationsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,98 +91,69 @@ func (client *GalleryApplicationsClient) createOrUpdateCreateRequest(ctx context return nil, errors.New("parameter galleryApplicationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(galleryApplication) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, galleryApplication) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *GalleryApplicationsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryApplicationsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - Delete a gallery Application. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *GalleryApplicationsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsBeginDeleteOptions) (GalleryApplicationsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, galleryName, galleryApplicationName, options) if err != nil { - return HTTPPollerResponse{}, err + return GalleryApplicationsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := GalleryApplicationsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("GalleryApplicationsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("GalleryApplicationsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return GalleryApplicationsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &GalleryApplicationsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *GalleryApplicationsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryApplicationsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Delete a gallery Application. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsBeginDeleteOptions) (*azcore.Response, error) { +func (client *GalleryApplicationsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *GalleryApplicationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsBeginDeleteOptions) (*azcore.Request, error) { +func (client *GalleryApplicationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -224,50 +171,49 @@ func (client *GalleryApplicationsClient) deleteCreateRequest(ctx context.Context return nil, errors.New("parameter galleryApplicationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *GalleryApplicationsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryApplicationsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - Retrieves information about a gallery Application Definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsGetOptions) (GalleryApplicationResponse, error) { +func (client *GalleryApplicationsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsGetOptions) (GalleryApplicationsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, options) if err != nil { - return GalleryApplicationResponse{}, err + return GalleryApplicationsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return GalleryApplicationResponse{}, err + return GalleryApplicationsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return GalleryApplicationResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryApplicationsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *GalleryApplicationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsGetOptions) (*azcore.Request, error) { +func (client *GalleryApplicationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -285,59 +231,55 @@ func (client *GalleryApplicationsClient) getCreateRequest(ctx context.Context, r return nil, errors.New("parameter galleryApplicationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *GalleryApplicationsClient) getHandleResponse(resp *azcore.Response) (GalleryApplicationResponse, error) { - var val *GalleryApplication - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryApplicationResponse{}, err +func (client *GalleryApplicationsClient) getHandleResponse(resp *http.Response) (GalleryApplicationsGetResponse, error) { + result := GalleryApplicationsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplication); err != nil { + return GalleryApplicationsGetResponse{}, err } - return GalleryApplicationResponse{RawResponse: resp.Response, GalleryApplication: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *GalleryApplicationsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryApplicationsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListByGallery - List gallery Application Definitions in a gallery. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationsClient) ListByGallery(resourceGroupName string, galleryName string, options *GalleryApplicationsListByGalleryOptions) GalleryApplicationListPager { - return &galleryApplicationListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *GalleryApplicationsClient) ListByGallery(resourceGroupName string, galleryName string, options *GalleryApplicationsListByGalleryOptions) *GalleryApplicationsListByGalleryPager { + return &GalleryApplicationsListByGalleryPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByGalleryCreateRequest(ctx, resourceGroupName, galleryName, options) }, - responder: client.listByGalleryHandleResponse, - errorer: client.listByGalleryHandleError, - advancer: func(ctx context.Context, resp GalleryApplicationListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.GalleryApplicationList.NextLink) + advancer: func(ctx context.Context, resp GalleryApplicationsListByGalleryResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.GalleryApplicationList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByGalleryCreateRequest creates the ListByGallery request. -func (client *GalleryApplicationsClient) listByGalleryCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleryApplicationsListByGalleryOptions) (*azcore.Request, error) { +func (client *GalleryApplicationsClient) listByGalleryCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleryApplicationsListByGalleryOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -351,107 +293,78 @@ func (client *GalleryApplicationsClient) listByGalleryCreateRequest(ctx context. return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByGalleryHandleResponse handles the ListByGallery response. -func (client *GalleryApplicationsClient) listByGalleryHandleResponse(resp *azcore.Response) (GalleryApplicationListResponse, error) { - var val *GalleryApplicationList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryApplicationListResponse{}, err +func (client *GalleryApplicationsClient) listByGalleryHandleResponse(resp *http.Response) (GalleryApplicationsListByGalleryResponse, error) { + result := GalleryApplicationsListByGalleryResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplicationList); err != nil { + return GalleryApplicationsListByGalleryResponse{}, err } - return GalleryApplicationListResponse{RawResponse: resp.Response, GalleryApplicationList: val}, nil + return result, nil } // listByGalleryHandleError handles the ListByGallery error response. -func (client *GalleryApplicationsClient) listByGalleryHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryApplicationsClient) listByGalleryHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - Update a gallery Application Definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsBeginUpdateOptions) (GalleryApplicationPollerResponse, error) { +func (client *GalleryApplicationsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsBeginUpdateOptions) (GalleryApplicationsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) if err != nil { - return GalleryApplicationPollerResponse{}, err - } - result := GalleryApplicationPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("GalleryApplicationsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return GalleryApplicationPollerResponse{}, err + return GalleryApplicationsUpdatePollerResponse{}, err } - poller := &galleryApplicationPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryApplicationResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := GalleryApplicationsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new GalleryApplicationPoller from the specified resume token. -// token - The value must come from a previous call to GalleryApplicationPoller.ResumeToken(). -func (client *GalleryApplicationsClient) ResumeUpdate(ctx context.Context, token string) (GalleryApplicationPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryApplicationsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("GalleryApplicationsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return GalleryApplicationPollerResponse{}, err + return GalleryApplicationsUpdatePollerResponse{}, err } - poller := &galleryApplicationPoller{ + result.Poller = &GalleryApplicationsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return GalleryApplicationPollerResponse{}, err - } - result := GalleryApplicationPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryApplicationResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Update a gallery Application Definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsBeginUpdateOptions) (*azcore.Response, error) { +func (client *GalleryApplicationsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplication, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *GalleryApplicationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsBeginUpdateOptions) (*azcore.Request, error) { +func (client *GalleryApplicationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplication GalleryApplicationUpdate, options *GalleryApplicationsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -469,27 +382,26 @@ func (client *GalleryApplicationsClient) updateCreateRequest(ctx context.Context return nil, errors.New("parameter galleryApplicationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(galleryApplication) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, galleryApplication) } // updateHandleError handles the Update error response. -func (client *GalleryApplicationsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryApplicationsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_galleryapplicationversions_client.go b/sdk/compute/armcompute/zz_generated_galleryapplicationversions_client.go index 39feea0e302b..823c5d640a8f 100644 --- a/sdk/compute/armcompute/zz_generated_galleryapplicationversions_client.go +++ b/sdk/compute/armcompute/zz_generated_galleryapplicationversions_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GalleryApplicationVersionsClient contains the methods for the GalleryApplicationVersions group. // Don't use this type directly, use NewGalleryApplicationVersionsClient() instead. type GalleryApplicationVersionsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewGalleryApplicationVersionsClient creates a new instance of GalleryApplicationVersionsClient with the specified values. -func NewGalleryApplicationVersionsClient(con *armcore.Connection, subscriptionID string) *GalleryApplicationVersionsClient { - return &GalleryApplicationVersionsClient{con: con, subscriptionID: subscriptionID} +func NewGalleryApplicationVersionsClient(con *arm.Connection, subscriptionID string) *GalleryApplicationVersionsClient { + return &GalleryApplicationVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Create or update a gallery Application Version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsBeginCreateOrUpdateOptions) (GalleryApplicationVersionPollerResponse, error) { +func (client *GalleryApplicationVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsBeginCreateOrUpdateOptions) (GalleryApplicationVersionsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) if err != nil { - return GalleryApplicationVersionPollerResponse{}, err + return GalleryApplicationVersionsCreateOrUpdatePollerResponse{}, err } - result := GalleryApplicationVersionPollerResponse{ - RawResponse: resp.Response, + result := GalleryApplicationVersionsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("GalleryApplicationVersionsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("GalleryApplicationVersionsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return GalleryApplicationVersionPollerResponse{}, err + return GalleryApplicationVersionsCreateOrUpdatePollerResponse{}, err } - poller := &galleryApplicationVersionPoller{ + result.Poller = &GalleryApplicationVersionsCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryApplicationVersionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new GalleryApplicationVersionPoller from the specified resume token. -// token - The value must come from a previous call to GalleryApplicationVersionPoller.ResumeToken(). -func (client *GalleryApplicationVersionsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (GalleryApplicationVersionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryApplicationVersionsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return GalleryApplicationVersionPollerResponse{}, err - } - poller := &galleryApplicationVersionPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return GalleryApplicationVersionPollerResponse{}, err - } - result := GalleryApplicationVersionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryApplicationVersionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Create or update a gallery Application Version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *GalleryApplicationVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GalleryApplicationVersionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *GalleryApplicationVersionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersion, options *GalleryApplicationVersionsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -119,98 +95,69 @@ func (client *GalleryApplicationVersionsClient) createOrUpdateCreateRequest(ctx return nil, errors.New("parameter galleryApplicationVersionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationVersionName}", url.PathEscape(galleryApplicationVersionName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(galleryApplicationVersion) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, galleryApplicationVersion) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *GalleryApplicationVersionsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryApplicationVersionsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - Delete a gallery Application Version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *GalleryApplicationVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsBeginDeleteOptions) (GalleryApplicationVersionsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, options) if err != nil { - return HTTPPollerResponse{}, err + return GalleryApplicationVersionsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := GalleryApplicationVersionsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("GalleryApplicationVersionsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("GalleryApplicationVersionsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return GalleryApplicationVersionsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &GalleryApplicationVersionsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *GalleryApplicationVersionsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryApplicationVersionsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Delete a gallery Application Version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsBeginDeleteOptions) (*azcore.Response, error) { +func (client *GalleryApplicationVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *GalleryApplicationVersionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsBeginDeleteOptions) (*azcore.Request, error) { +func (client *GalleryApplicationVersionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -232,50 +179,49 @@ func (client *GalleryApplicationVersionsClient) deleteCreateRequest(ctx context. return nil, errors.New("parameter galleryApplicationVersionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationVersionName}", url.PathEscape(galleryApplicationVersionName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *GalleryApplicationVersionsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryApplicationVersionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - Retrieves information about a gallery Application Version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsGetOptions) (GalleryApplicationVersionResponse, error) { +func (client *GalleryApplicationVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsGetOptions) (GalleryApplicationVersionsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, options) if err != nil { - return GalleryApplicationVersionResponse{}, err + return GalleryApplicationVersionsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return GalleryApplicationVersionResponse{}, err + return GalleryApplicationVersionsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return GalleryApplicationVersionResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryApplicationVersionsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *GalleryApplicationVersionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsGetOptions) (*azcore.Request, error) { +func (client *GalleryApplicationVersionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, options *GalleryApplicationVersionsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -297,62 +243,58 @@ func (client *GalleryApplicationVersionsClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter galleryApplicationVersionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationVersionName}", url.PathEscape(galleryApplicationVersionName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *GalleryApplicationVersionsClient) getHandleResponse(resp *azcore.Response) (GalleryApplicationVersionResponse, error) { - var val *GalleryApplicationVersion - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryApplicationVersionResponse{}, err +func (client *GalleryApplicationVersionsClient) getHandleResponse(resp *http.Response) (GalleryApplicationVersionsGetResponse, error) { + result := GalleryApplicationVersionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplicationVersion); err != nil { + return GalleryApplicationVersionsGetResponse{}, err } - return GalleryApplicationVersionResponse{RawResponse: resp.Response, GalleryApplicationVersion: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *GalleryApplicationVersionsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryApplicationVersionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListByGalleryApplication - List gallery Application Versions in a gallery Application Definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationVersionsClient) ListByGalleryApplication(resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationVersionsListByGalleryApplicationOptions) GalleryApplicationVersionListPager { - return &galleryApplicationVersionListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *GalleryApplicationVersionsClient) ListByGalleryApplication(resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationVersionsListByGalleryApplicationOptions) *GalleryApplicationVersionsListByGalleryApplicationPager { + return &GalleryApplicationVersionsListByGalleryApplicationPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByGalleryApplicationCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, options) }, - responder: client.listByGalleryApplicationHandleResponse, - errorer: client.listByGalleryApplicationHandleError, - advancer: func(ctx context.Context, resp GalleryApplicationVersionListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.GalleryApplicationVersionList.NextLink) + advancer: func(ctx context.Context, resp GalleryApplicationVersionsListByGalleryApplicationResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.GalleryApplicationVersionList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByGalleryApplicationCreateRequest creates the ListByGalleryApplication request. -func (client *GalleryApplicationVersionsClient) listByGalleryApplicationCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationVersionsListByGalleryApplicationOptions) (*azcore.Request, error) { +func (client *GalleryApplicationVersionsClient) listByGalleryApplicationCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, options *GalleryApplicationVersionsListByGalleryApplicationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -370,107 +312,78 @@ func (client *GalleryApplicationVersionsClient) listByGalleryApplicationCreateRe return nil, errors.New("parameter galleryApplicationName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationName}", url.PathEscape(galleryApplicationName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByGalleryApplicationHandleResponse handles the ListByGalleryApplication response. -func (client *GalleryApplicationVersionsClient) listByGalleryApplicationHandleResponse(resp *azcore.Response) (GalleryApplicationVersionListResponse, error) { - var val *GalleryApplicationVersionList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryApplicationVersionListResponse{}, err +func (client *GalleryApplicationVersionsClient) listByGalleryApplicationHandleResponse(resp *http.Response) (GalleryApplicationVersionsListByGalleryApplicationResponse, error) { + result := GalleryApplicationVersionsListByGalleryApplicationResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplicationVersionList); err != nil { + return GalleryApplicationVersionsListByGalleryApplicationResponse{}, err } - return GalleryApplicationVersionListResponse{RawResponse: resp.Response, GalleryApplicationVersionList: val}, nil + return result, nil } // listByGalleryApplicationHandleError handles the ListByGalleryApplication error response. -func (client *GalleryApplicationVersionsClient) listByGalleryApplicationHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryApplicationVersionsClient) listByGalleryApplicationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - Update a gallery Application Version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationVersionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsBeginUpdateOptions) (GalleryApplicationVersionPollerResponse, error) { +func (client *GalleryApplicationVersionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsBeginUpdateOptions) (GalleryApplicationVersionsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) if err != nil { - return GalleryApplicationVersionPollerResponse{}, err - } - result := GalleryApplicationVersionPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("GalleryApplicationVersionsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return GalleryApplicationVersionPollerResponse{}, err + return GalleryApplicationVersionsUpdatePollerResponse{}, err } - poller := &galleryApplicationVersionPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryApplicationVersionResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := GalleryApplicationVersionsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new GalleryApplicationVersionPoller from the specified resume token. -// token - The value must come from a previous call to GalleryApplicationVersionPoller.ResumeToken(). -func (client *GalleryApplicationVersionsClient) ResumeUpdate(ctx context.Context, token string) (GalleryApplicationVersionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryApplicationVersionsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("GalleryApplicationVersionsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return GalleryApplicationVersionPollerResponse{}, err + return GalleryApplicationVersionsUpdatePollerResponse{}, err } - poller := &galleryApplicationVersionPoller{ + result.Poller = &GalleryApplicationVersionsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return GalleryApplicationVersionPollerResponse{}, err - } - result := GalleryApplicationVersionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryApplicationVersionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Update a gallery Application Version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryApplicationVersionsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsBeginUpdateOptions) (*azcore.Response, error) { +func (client *GalleryApplicationVersionsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryApplicationName, galleryApplicationVersionName, galleryApplicationVersion, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *GalleryApplicationVersionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsBeginUpdateOptions) (*azcore.Request, error) { +func (client *GalleryApplicationVersionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryApplicationName string, galleryApplicationVersionName string, galleryApplicationVersion GalleryApplicationVersionUpdate, options *GalleryApplicationVersionsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -492,27 +405,26 @@ func (client *GalleryApplicationVersionsClient) updateCreateRequest(ctx context. return nil, errors.New("parameter galleryApplicationVersionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryApplicationVersionName}", url.PathEscape(galleryApplicationVersionName)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(galleryApplicationVersion) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, galleryApplicationVersion) } // updateHandleError handles the Update error response. -func (client *GalleryApplicationVersionsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryApplicationVersionsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_galleryimages_client.go b/sdk/compute/armcompute/zz_generated_galleryimages_client.go index cb40194a9737..70f9b48b1d91 100644 --- a/sdk/compute/armcompute/zz_generated_galleryimages_client.go +++ b/sdk/compute/armcompute/zz_generated_galleryimages_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GalleryImagesClient contains the methods for the GalleryImages group. // Don't use this type directly, use NewGalleryImagesClient() instead. type GalleryImagesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewGalleryImagesClient creates a new instance of GalleryImagesClient with the specified values. -func NewGalleryImagesClient(con *armcore.Connection, subscriptionID string) *GalleryImagesClient { - return &GalleryImagesClient{con: con, subscriptionID: subscriptionID} +func NewGalleryImagesClient(con *arm.Connection, subscriptionID string) *GalleryImagesClient { + return &GalleryImagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Create or update a gallery image definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesBeginCreateOrUpdateOptions) (GalleryImagePollerResponse, error) { +func (client *GalleryImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesBeginCreateOrUpdateOptions) (GalleryImagesCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) if err != nil { - return GalleryImagePollerResponse{}, err + return GalleryImagesCreateOrUpdatePollerResponse{}, err } - result := GalleryImagePollerResponse{ - RawResponse: resp.Response, + result := GalleryImagesCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("GalleryImagesClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("GalleryImagesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return GalleryImagePollerResponse{}, err + return GalleryImagesCreateOrUpdatePollerResponse{}, err } - poller := &galleryImagePoller{ + result.Poller = &GalleryImagesCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryImageResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new GalleryImagePoller from the specified resume token. -// token - The value must come from a previous call to GalleryImagePoller.ResumeToken(). -func (client *GalleryImagesClient) ResumeCreateOrUpdate(ctx context.Context, token string) (GalleryImagePollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryImagesClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return GalleryImagePollerResponse{}, err - } - poller := &galleryImagePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return GalleryImagePollerResponse{}, err - } - result := GalleryImagePollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryImageResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Create or update a gallery image definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *GalleryImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImage, options *GalleryImagesBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,98 +91,69 @@ func (client *GalleryImagesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, errors.New("parameter galleryImageName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(galleryImage) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, galleryImage) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *GalleryImagesClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryImagesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - Delete a gallery image. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *GalleryImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesBeginDeleteOptions) (GalleryImagesDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, galleryName, galleryImageName, options) if err != nil { - return HTTPPollerResponse{}, err + return GalleryImagesDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := GalleryImagesDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("GalleryImagesClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("GalleryImagesClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return GalleryImagesDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &GalleryImagesDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *GalleryImagesClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryImagesClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Delete a gallery image. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesBeginDeleteOptions) (*azcore.Response, error) { +func (client *GalleryImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesBeginDeleteOptions) (*azcore.Request, error) { +func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -224,50 +171,49 @@ func (client *GalleryImagesClient) deleteCreateRequest(ctx context.Context, reso return nil, errors.New("parameter galleryImageName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *GalleryImagesClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryImagesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - Retrieves information about a gallery image definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImagesClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesGetOptions) (GalleryImageResponse, error) { +func (client *GalleryImagesClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesGetOptions) (GalleryImagesGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, options) if err != nil { - return GalleryImageResponse{}, err + return GalleryImagesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return GalleryImageResponse{}, err + return GalleryImagesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return GalleryImageResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryImagesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *GalleryImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesGetOptions) (*azcore.Request, error) { +func (client *GalleryImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImagesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -285,59 +231,55 @@ func (client *GalleryImagesClient) getCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter galleryImageName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *GalleryImagesClient) getHandleResponse(resp *azcore.Response) (GalleryImageResponse, error) { - var val *GalleryImage - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryImageResponse{}, err +func (client *GalleryImagesClient) getHandleResponse(resp *http.Response) (GalleryImagesGetResponse, error) { + result := GalleryImagesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImage); err != nil { + return GalleryImagesGetResponse{}, err } - return GalleryImageResponse{RawResponse: resp.Response, GalleryImage: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *GalleryImagesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryImagesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListByGallery - List gallery image definitions in a gallery. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImagesClient) ListByGallery(resourceGroupName string, galleryName string, options *GalleryImagesListByGalleryOptions) GalleryImageListPager { - return &galleryImageListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *GalleryImagesClient) ListByGallery(resourceGroupName string, galleryName string, options *GalleryImagesListByGalleryOptions) *GalleryImagesListByGalleryPager { + return &GalleryImagesListByGalleryPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByGalleryCreateRequest(ctx, resourceGroupName, galleryName, options) }, - responder: client.listByGalleryHandleResponse, - errorer: client.listByGalleryHandleError, - advancer: func(ctx context.Context, resp GalleryImageListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.GalleryImageList.NextLink) + advancer: func(ctx context.Context, resp GalleryImagesListByGalleryResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.GalleryImageList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByGalleryCreateRequest creates the ListByGallery request. -func (client *GalleryImagesClient) listByGalleryCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleryImagesListByGalleryOptions) (*azcore.Request, error) { +func (client *GalleryImagesClient) listByGalleryCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, options *GalleryImagesListByGalleryOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -351,107 +293,78 @@ func (client *GalleryImagesClient) listByGalleryCreateRequest(ctx context.Contex return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByGalleryHandleResponse handles the ListByGallery response. -func (client *GalleryImagesClient) listByGalleryHandleResponse(resp *azcore.Response) (GalleryImageListResponse, error) { - var val *GalleryImageList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryImageListResponse{}, err +func (client *GalleryImagesClient) listByGalleryHandleResponse(resp *http.Response) (GalleryImagesListByGalleryResponse, error) { + result := GalleryImagesListByGalleryResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImageList); err != nil { + return GalleryImagesListByGalleryResponse{}, err } - return GalleryImageListResponse{RawResponse: resp.Response, GalleryImageList: val}, nil + return result, nil } // listByGalleryHandleError handles the ListByGallery error response. -func (client *GalleryImagesClient) listByGalleryHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryImagesClient) listByGalleryHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - Update a gallery image definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImagesClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesBeginUpdateOptions) (GalleryImagePollerResponse, error) { +func (client *GalleryImagesClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesBeginUpdateOptions) (GalleryImagesUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) if err != nil { - return GalleryImagePollerResponse{}, err - } - result := GalleryImagePollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("GalleryImagesClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return GalleryImagePollerResponse{}, err + return GalleryImagesUpdatePollerResponse{}, err } - poller := &galleryImagePoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryImageResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := GalleryImagesUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new GalleryImagePoller from the specified resume token. -// token - The value must come from a previous call to GalleryImagePoller.ResumeToken(). -func (client *GalleryImagesClient) ResumeUpdate(ctx context.Context, token string) (GalleryImagePollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryImagesClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("GalleryImagesClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return GalleryImagePollerResponse{}, err + return GalleryImagesUpdatePollerResponse{}, err } - poller := &galleryImagePoller{ + result.Poller = &GalleryImagesUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return GalleryImagePollerResponse{}, err - } - result := GalleryImagePollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryImageResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Update a gallery image definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImagesClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesBeginUpdateOptions) (*azcore.Response, error) { +func (client *GalleryImagesClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImage, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *GalleryImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesBeginUpdateOptions) (*azcore.Request, error) { +func (client *GalleryImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImage GalleryImageUpdate, options *GalleryImagesBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -469,27 +382,26 @@ func (client *GalleryImagesClient) updateCreateRequest(ctx context.Context, reso return nil, errors.New("parameter galleryImageName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(galleryImage) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, galleryImage) } // updateHandleError handles the Update error response. -func (client *GalleryImagesClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryImagesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_galleryimageversions_client.go b/sdk/compute/armcompute/zz_generated_galleryimageversions_client.go index 3bb11ad6413c..d7243b8eae3d 100644 --- a/sdk/compute/armcompute/zz_generated_galleryimageversions_client.go +++ b/sdk/compute/armcompute/zz_generated_galleryimageversions_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GalleryImageVersionsClient contains the methods for the GalleryImageVersions group. // Don't use this type directly, use NewGalleryImageVersionsClient() instead. type GalleryImageVersionsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewGalleryImageVersionsClient creates a new instance of GalleryImageVersionsClient with the specified values. -func NewGalleryImageVersionsClient(con *armcore.Connection, subscriptionID string) *GalleryImageVersionsClient { - return &GalleryImageVersionsClient{con: con, subscriptionID: subscriptionID} +func NewGalleryImageVersionsClient(con *arm.Connection, subscriptionID string) *GalleryImageVersionsClient { + return &GalleryImageVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Create or update a gallery image version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImageVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsBeginCreateOrUpdateOptions) (GalleryImageVersionPollerResponse, error) { +func (client *GalleryImageVersionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsBeginCreateOrUpdateOptions) (GalleryImageVersionsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) if err != nil { - return GalleryImageVersionPollerResponse{}, err + return GalleryImageVersionsCreateOrUpdatePollerResponse{}, err } - result := GalleryImageVersionPollerResponse{ - RawResponse: resp.Response, + result := GalleryImageVersionsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("GalleryImageVersionsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("GalleryImageVersionsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return GalleryImageVersionPollerResponse{}, err + return GalleryImageVersionsCreateOrUpdatePollerResponse{}, err } - poller := &galleryImageVersionPoller{ + result.Poller = &GalleryImageVersionsCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryImageVersionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new GalleryImageVersionPoller from the specified resume token. -// token - The value must come from a previous call to GalleryImageVersionPoller.ResumeToken(). -func (client *GalleryImageVersionsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (GalleryImageVersionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryImageVersionsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return GalleryImageVersionPollerResponse{}, err - } - poller := &galleryImageVersionPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return GalleryImageVersionPollerResponse{}, err - } - result := GalleryImageVersionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryImageVersionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Create or update a gallery image version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImageVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *GalleryImageVersionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GalleryImageVersionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *GalleryImageVersionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersion, options *GalleryImageVersionsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -119,98 +95,69 @@ func (client *GalleryImageVersionsClient) createOrUpdateCreateRequest(ctx contex return nil, errors.New("parameter galleryImageVersionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(galleryImageVersion) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, galleryImageVersion) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *GalleryImageVersionsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryImageVersionsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - Delete a gallery image version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImageVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *GalleryImageVersionsClient) BeginDelete(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsBeginDeleteOptions) (GalleryImageVersionsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, options) if err != nil { - return HTTPPollerResponse{}, err + return GalleryImageVersionsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := GalleryImageVersionsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("GalleryImageVersionsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("GalleryImageVersionsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return GalleryImageVersionsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &GalleryImageVersionsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *GalleryImageVersionsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryImageVersionsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Delete a gallery image version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImageVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsBeginDeleteOptions) (*azcore.Response, error) { +func (client *GalleryImageVersionsClient) deleteOperation(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *GalleryImageVersionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsBeginDeleteOptions) (*azcore.Request, error) { +func (client *GalleryImageVersionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -232,50 +179,49 @@ func (client *GalleryImageVersionsClient) deleteCreateRequest(ctx context.Contex return nil, errors.New("parameter galleryImageVersionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *GalleryImageVersionsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryImageVersionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - Retrieves information about a gallery image version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImageVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsGetOptions) (GalleryImageVersionResponse, error) { +func (client *GalleryImageVersionsClient) Get(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsGetOptions) (GalleryImageVersionsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, options) if err != nil { - return GalleryImageVersionResponse{}, err + return GalleryImageVersionsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return GalleryImageVersionResponse{}, err + return GalleryImageVersionsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return GalleryImageVersionResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GalleryImageVersionsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *GalleryImageVersionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsGetOptions) (*azcore.Request, error) { +func (client *GalleryImageVersionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, options *GalleryImageVersionsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -297,62 +243,58 @@ func (client *GalleryImageVersionsClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter galleryImageVersionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *GalleryImageVersionsClient) getHandleResponse(resp *azcore.Response) (GalleryImageVersionResponse, error) { - var val *GalleryImageVersion - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryImageVersionResponse{}, err +func (client *GalleryImageVersionsClient) getHandleResponse(resp *http.Response) (GalleryImageVersionsGetResponse, error) { + result := GalleryImageVersionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImageVersion); err != nil { + return GalleryImageVersionsGetResponse{}, err } - return GalleryImageVersionResponse{RawResponse: resp.Response, GalleryImageVersion: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *GalleryImageVersionsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryImageVersionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListByGalleryImage - List gallery image versions in a gallery image definition. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImageVersionsClient) ListByGalleryImage(resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImageVersionsListByGalleryImageOptions) GalleryImageVersionListPager { - return &galleryImageVersionListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *GalleryImageVersionsClient) ListByGalleryImage(resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImageVersionsListByGalleryImageOptions) *GalleryImageVersionsListByGalleryImagePager { + return &GalleryImageVersionsListByGalleryImagePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByGalleryImageCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, options) }, - responder: client.listByGalleryImageHandleResponse, - errorer: client.listByGalleryImageHandleError, - advancer: func(ctx context.Context, resp GalleryImageVersionListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.GalleryImageVersionList.NextLink) + advancer: func(ctx context.Context, resp GalleryImageVersionsListByGalleryImageResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.GalleryImageVersionList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByGalleryImageCreateRequest creates the ListByGalleryImage request. -func (client *GalleryImageVersionsClient) listByGalleryImageCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImageVersionsListByGalleryImageOptions) (*azcore.Request, error) { +func (client *GalleryImageVersionsClient) listByGalleryImageCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, options *GalleryImageVersionsListByGalleryImageOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -370,107 +312,78 @@ func (client *GalleryImageVersionsClient) listByGalleryImageCreateRequest(ctx co return nil, errors.New("parameter galleryImageName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByGalleryImageHandleResponse handles the ListByGalleryImage response. -func (client *GalleryImageVersionsClient) listByGalleryImageHandleResponse(resp *azcore.Response) (GalleryImageVersionListResponse, error) { - var val *GalleryImageVersionList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return GalleryImageVersionListResponse{}, err +func (client *GalleryImageVersionsClient) listByGalleryImageHandleResponse(resp *http.Response) (GalleryImageVersionsListByGalleryImageResponse, error) { + result := GalleryImageVersionsListByGalleryImageResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImageVersionList); err != nil { + return GalleryImageVersionsListByGalleryImageResponse{}, err } - return GalleryImageVersionListResponse{RawResponse: resp.Response, GalleryImageVersionList: val}, nil + return result, nil } // listByGalleryImageHandleError handles the ListByGalleryImage error response. -func (client *GalleryImageVersionsClient) listByGalleryImageHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryImageVersionsClient) listByGalleryImageHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - Update a gallery image version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImageVersionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsBeginUpdateOptions) (GalleryImageVersionPollerResponse, error) { +func (client *GalleryImageVersionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsBeginUpdateOptions) (GalleryImageVersionsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) if err != nil { - return GalleryImageVersionPollerResponse{}, err - } - result := GalleryImageVersionPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("GalleryImageVersionsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return GalleryImageVersionPollerResponse{}, err + return GalleryImageVersionsUpdatePollerResponse{}, err } - poller := &galleryImageVersionPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryImageVersionResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := GalleryImageVersionsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new GalleryImageVersionPoller from the specified resume token. -// token - The value must come from a previous call to GalleryImageVersionPoller.ResumeToken(). -func (client *GalleryImageVersionsClient) ResumeUpdate(ctx context.Context, token string) (GalleryImageVersionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GalleryImageVersionsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("GalleryImageVersionsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return GalleryImageVersionPollerResponse{}, err + return GalleryImageVersionsUpdatePollerResponse{}, err } - poller := &galleryImageVersionPoller{ + result.Poller = &GalleryImageVersionsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return GalleryImageVersionPollerResponse{}, err - } - result := GalleryImageVersionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (GalleryImageVersionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Update a gallery image version. // If the operation fails it returns the *CloudError error type. -func (client *GalleryImageVersionsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsBeginUpdateOptions) (*azcore.Response, error) { +func (client *GalleryImageVersionsClient) update(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, galleryImageVersion, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *GalleryImageVersionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsBeginUpdateOptions) (*azcore.Request, error) { +func (client *GalleryImageVersionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, galleryImageName string, galleryImageVersionName string, galleryImageVersion GalleryImageVersionUpdate, options *GalleryImageVersionsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -492,27 +405,26 @@ func (client *GalleryImageVersionsClient) updateCreateRequest(ctx context.Contex return nil, errors.New("parameter galleryImageVersionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(galleryImageVersion) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, galleryImageVersion) } // updateHandleError handles the Update error response. -func (client *GalleryImageVersionsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GalleryImageVersionsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_gallerysharingprofile_client.go b/sdk/compute/armcompute/zz_generated_gallerysharingprofile_client.go index facdb3b3ea9f..1bfc848c1d9e 100644 --- a/sdk/compute/armcompute/zz_generated_gallerysharingprofile_client.go +++ b/sdk/compute/armcompute/zz_generated_gallerysharingprofile_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GallerySharingProfileClient contains the methods for the GallerySharingProfile group. // Don't use this type directly, use NewGallerySharingProfileClient() instead. type GallerySharingProfileClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewGallerySharingProfileClient creates a new instance of GallerySharingProfileClient with the specified values. -func NewGallerySharingProfileClient(con *armcore.Connection, subscriptionID string) *GallerySharingProfileClient { - return &GallerySharingProfileClient{con: con, subscriptionID: subscriptionID} +func NewGallerySharingProfileClient(con *arm.Connection, subscriptionID string) *GallerySharingProfileClient { + return &GallerySharingProfileClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginUpdate - Update sharing profile of a gallery. // If the operation fails it returns the *CloudError error type. -func (client *GallerySharingProfileClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileBeginUpdateOptions) (SharingUpdatePollerResponse, error) { +func (client *GallerySharingProfileClient) BeginUpdate(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileBeginUpdateOptions) (GallerySharingProfileUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, galleryName, sharingUpdate, options) if err != nil { - return SharingUpdatePollerResponse{}, err + return GallerySharingProfileUpdatePollerResponse{}, err } - result := SharingUpdatePollerResponse{ - RawResponse: resp.Response, + result := GallerySharingProfileUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("GallerySharingProfileClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("GallerySharingProfileClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return SharingUpdatePollerResponse{}, err + return GallerySharingProfileUpdatePollerResponse{}, err } - poller := &sharingUpdatePoller{ + result.Poller = &GallerySharingProfileUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (SharingUpdateResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeUpdate creates a new SharingUpdatePoller from the specified resume token. -// token - The value must come from a previous call to SharingUpdatePoller.ResumeToken(). -func (client *GallerySharingProfileClient) ResumeUpdate(ctx context.Context, token string) (SharingUpdatePollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("GallerySharingProfileClient.Update", token, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return SharingUpdatePollerResponse{}, err - } - poller := &sharingUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return SharingUpdatePollerResponse{}, err - } - result := SharingUpdatePollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (SharingUpdateResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Update sharing profile of a gallery. // If the operation fails it returns the *CloudError error type. -func (client *GallerySharingProfileClient) update(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileBeginUpdateOptions) (*azcore.Response, error) { +func (client *GallerySharingProfileClient) update(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, galleryName, sharingUpdate, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *GallerySharingProfileClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileBeginUpdateOptions) (*azcore.Request, error) { +func (client *GallerySharingProfileClient) updateCreateRequest(ctx context.Context, resourceGroupName string, galleryName string, sharingUpdate SharingUpdate, options *GallerySharingProfileBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/share" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -111,27 +87,26 @@ func (client *GallerySharingProfileClient) updateCreateRequest(ctx context.Conte return nil, errors.New("parameter galleryName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryName}", url.PathEscape(galleryName)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(sharingUpdate) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, sharingUpdate) } // updateHandleError handles the Update error response. -func (client *GallerySharingProfileClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *GallerySharingProfileClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_images_client.go b/sdk/compute/armcompute/zz_generated_images_client.go index 8070a4a62442..826bf8770ad1 100644 --- a/sdk/compute/armcompute/zz_generated_images_client.go +++ b/sdk/compute/armcompute/zz_generated_images_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,93 +11,68 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ImagesClient contains the methods for the Images group. // Don't use this type directly, use NewImagesClient() instead. type ImagesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewImagesClient creates a new instance of ImagesClient with the specified values. -func NewImagesClient(con *armcore.Connection, subscriptionID string) *ImagesClient { - return &ImagesClient{con: con, subscriptionID: subscriptionID} +func NewImagesClient(con *arm.Connection, subscriptionID string) *ImagesClient { + return &ImagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Create or update an image. // If the operation fails it returns a generic error. -func (client *ImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesBeginCreateOrUpdateOptions) (ImagePollerResponse, error) { +func (client *ImagesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesBeginCreateOrUpdateOptions) (ImagesCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, imageName, parameters, options) if err != nil { - return ImagePollerResponse{}, err + return ImagesCreateOrUpdatePollerResponse{}, err } - result := ImagePollerResponse{ - RawResponse: resp.Response, + result := ImagesCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("ImagesClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("ImagesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return ImagePollerResponse{}, err + return ImagesCreateOrUpdatePollerResponse{}, err } - poller := &imagePoller{ + result.Poller = &ImagesCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (ImageResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new ImagePoller from the specified resume token. -// token - The value must come from a previous call to ImagePoller.ResumeToken(). -func (client *ImagesClient) ResumeCreateOrUpdate(ctx context.Context, token string) (ImagePollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("ImagesClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return ImagePollerResponse{}, err - } - poller := &imagePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return ImagePollerResponse{}, err - } - result := ImagePollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (ImageResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Create or update an image. // If the operation fails it returns a generic error. -func (client *ImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *ImagesClient) createOrUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, imageName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, imageName string, parameters Image, options *ImagesBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -110,97 +86,68 @@ func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *ImagesClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ImagesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDelete - Deletes an Image. // If the operation fails it returns a generic error. -func (client *ImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, imageName string, options *ImagesBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *ImagesClient) BeginDelete(ctx context.Context, resourceGroupName string, imageName string, options *ImagesBeginDeleteOptions) (ImagesDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, imageName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("ImagesClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return ImagesDeletePollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := ImagesDeletePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *ImagesClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("ImagesClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("ImagesClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return ImagesDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &ImagesDeletePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Deletes an Image. // If the operation fails it returns a generic error. -func (client *ImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, imageName string, options *ImagesBeginDeleteOptions) (*azcore.Response, error) { +func (client *ImagesClient) deleteOperation(ctx context.Context, resourceGroupName string, imageName string, options *ImagesBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, imageName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, imageName string, options *ImagesBeginDeleteOptions) (*azcore.Request, error) { +func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, imageName string, options *ImagesBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -214,48 +161,47 @@ func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *ImagesClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ImagesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Gets an image. // If the operation fails it returns a generic error. -func (client *ImagesClient) Get(ctx context.Context, resourceGroupName string, imageName string, options *ImagesGetOptions) (ImageResponse, error) { +func (client *ImagesClient) Get(ctx context.Context, resourceGroupName string, imageName string, options *ImagesGetOptions) (ImagesGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, imageName, options) if err != nil { - return ImageResponse{}, err + return ImagesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return ImageResponse{}, err + return ImagesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return ImageResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImagesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, imageName string, options *ImagesGetOptions) (*azcore.Request, error) { +func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, imageName string, options *ImagesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -269,119 +215,111 @@ func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *ImagesClient) getHandleResponse(resp *azcore.Response) (ImageResponse, error) { - var val *Image - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ImageResponse{}, err +func (client *ImagesClient) getHandleResponse(resp *http.Response) (ImagesGetResponse, error) { + result := ImagesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Image); err != nil { + return ImagesGetResponse{}, err } - return ImageResponse{RawResponse: resp.Response, Image: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *ImagesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ImagesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - 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. // If the operation fails it returns a generic error. -func (client *ImagesClient) List(options *ImagesListOptions) ImageListResultPager { - return &imageListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *ImagesClient) List(options *ImagesListOptions) *ImagesListPager { + return &ImagesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp ImageListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.ImageListResult.NextLink) + advancer: func(ctx context.Context, resp ImagesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ImageListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *ImagesClient) listCreateRequest(ctx context.Context, options *ImagesListOptions) (*azcore.Request, error) { +func (client *ImagesClient) listCreateRequest(ctx context.Context, options *ImagesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *ImagesClient) listHandleResponse(resp *azcore.Response) (ImageListResultResponse, error) { - var val *ImageListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ImageListResultResponse{}, err +func (client *ImagesClient) listHandleResponse(resp *http.Response) (ImagesListResponse, error) { + result := ImagesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageListResult); err != nil { + return ImagesListResponse{}, err } - return ImageListResultResponse{RawResponse: resp.Response, ImageListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *ImagesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ImagesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListByResourceGroup - Gets the list of images under a resource group. // If the operation fails it returns a generic error. -func (client *ImagesClient) ListByResourceGroup(resourceGroupName string, options *ImagesListByResourceGroupOptions) ImageListResultPager { - return &imageListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *ImagesClient) ListByResourceGroup(resourceGroupName string, options *ImagesListByResourceGroupOptions) *ImagesListByResourceGroupPager { + return &ImagesListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listByResourceGroupHandleResponse, - errorer: client.listByResourceGroupHandleError, - advancer: func(ctx context.Context, resp ImageListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.ImageListResult.NextLink) + advancer: func(ctx context.Context, resp ImagesListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ImageListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ImagesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ImagesListByResourceGroupOptions) (*azcore.Request, error) { +func (client *ImagesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ImagesListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -391,106 +329,77 @@ func (client *ImagesClient) listByResourceGroupCreateRequest(ctx context.Context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *ImagesClient) listByResourceGroupHandleResponse(resp *azcore.Response) (ImageListResultResponse, error) { - var val *ImageListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ImageListResultResponse{}, err +func (client *ImagesClient) listByResourceGroupHandleResponse(resp *http.Response) (ImagesListByResourceGroupResponse, error) { + result := ImagesListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ImageListResult); err != nil { + return ImagesListByResourceGroupResponse{}, err } - return ImageListResultResponse{RawResponse: resp.Response, ImageListResult: val}, nil + return result, nil } // listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *ImagesClient) listByResourceGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ImagesClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginUpdate - Update an image. // If the operation fails it returns a generic error. -func (client *ImagesClient) BeginUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesBeginUpdateOptions) (ImagePollerResponse, error) { +func (client *ImagesClient) BeginUpdate(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesBeginUpdateOptions) (ImagesUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, imageName, parameters, options) if err != nil { - return ImagePollerResponse{}, err - } - result := ImagePollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("ImagesClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return ImagePollerResponse{}, err + return ImagesUpdatePollerResponse{}, err } - poller := &imagePoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (ImageResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := ImagesUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new ImagePoller from the specified resume token. -// token - The value must come from a previous call to ImagePoller.ResumeToken(). -func (client *ImagesClient) ResumeUpdate(ctx context.Context, token string) (ImagePollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("ImagesClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("ImagesClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return ImagePollerResponse{}, err + return ImagesUpdatePollerResponse{}, err } - poller := &imagePoller{ + result.Poller = &ImagesUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return ImagePollerResponse{}, err - } - result := ImagePollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (ImageResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Update an image. // If the operation fails it returns a generic error. -func (client *ImagesClient) update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesBeginUpdateOptions) (*azcore.Response, error) { +func (client *ImagesClient) update(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, imageName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *ImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesBeginUpdateOptions) (*azcore.Request, error) { +func (client *ImagesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, imageName string, parameters ImageUpdate, options *ImagesBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -504,26 +413,25 @@ func (client *ImagesClient) updateCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // updateHandleError handles the Update error response. -func (client *ImagesClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ImagesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_loganalytics_client.go b/sdk/compute/armcompute/zz_generated_loganalytics_client.go index ad322dc1749c..9ad56496608d 100644 --- a/sdk/compute/armcompute/zz_generated_loganalytics_client.go +++ b/sdk/compute/armcompute/zz_generated_loganalytics_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,93 +11,68 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // LogAnalyticsClient contains the methods for the LogAnalytics group. // Don't use this type directly, use NewLogAnalyticsClient() instead. type LogAnalyticsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewLogAnalyticsClient creates a new instance of LogAnalyticsClient with the specified values. -func NewLogAnalyticsClient(con *armcore.Connection, subscriptionID string) *LogAnalyticsClient { - return &LogAnalyticsClient{con: con, subscriptionID: subscriptionID} +func NewLogAnalyticsClient(con *arm.Connection, subscriptionID string) *LogAnalyticsClient { + return &LogAnalyticsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginExportRequestRateByInterval - Export logs that show Api requests made by this subscription in the given time window to show throttling activities. // If the operation fails it returns a generic error. -func (client *LogAnalyticsClient) BeginExportRequestRateByInterval(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsBeginExportRequestRateByIntervalOptions) (LogAnalyticsOperationResultPollerResponse, error) { +func (client *LogAnalyticsClient) BeginExportRequestRateByInterval(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsBeginExportRequestRateByIntervalOptions) (LogAnalyticsExportRequestRateByIntervalPollerResponse, error) { resp, err := client.exportRequestRateByInterval(ctx, location, parameters, options) if err != nil { - return LogAnalyticsOperationResultPollerResponse{}, err + return LogAnalyticsExportRequestRateByIntervalPollerResponse{}, err } - result := LogAnalyticsOperationResultPollerResponse{ - RawResponse: resp.Response, + result := LogAnalyticsExportRequestRateByIntervalPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("LogAnalyticsClient.ExportRequestRateByInterval", "azure-async-operation", resp, client.con.Pipeline(), client.exportRequestRateByIntervalHandleError) + pt, err := armruntime.NewPoller("LogAnalyticsClient.ExportRequestRateByInterval", "azure-async-operation", resp, client.pl, client.exportRequestRateByIntervalHandleError) if err != nil { - return LogAnalyticsOperationResultPollerResponse{}, err + return LogAnalyticsExportRequestRateByIntervalPollerResponse{}, err } - poller := &logAnalyticsOperationResultPoller{ + result.Poller = &LogAnalyticsExportRequestRateByIntervalPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (LogAnalyticsOperationResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeExportRequestRateByInterval creates a new LogAnalyticsOperationResultPoller from the specified resume token. -// token - The value must come from a previous call to LogAnalyticsOperationResultPoller.ResumeToken(). -func (client *LogAnalyticsClient) ResumeExportRequestRateByInterval(ctx context.Context, token string) (LogAnalyticsOperationResultPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("LogAnalyticsClient.ExportRequestRateByInterval", token, client.con.Pipeline(), client.exportRequestRateByIntervalHandleError) - if err != nil { - return LogAnalyticsOperationResultPollerResponse{}, err - } - poller := &logAnalyticsOperationResultPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return LogAnalyticsOperationResultPollerResponse{}, err - } - result := LogAnalyticsOperationResultPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (LogAnalyticsOperationResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // ExportRequestRateByInterval - Export logs that show Api requests made by this subscription in the given time window to show throttling activities. // If the operation fails it returns a generic error. -func (client *LogAnalyticsClient) exportRequestRateByInterval(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsBeginExportRequestRateByIntervalOptions) (*azcore.Response, error) { +func (client *LogAnalyticsClient) exportRequestRateByInterval(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsBeginExportRequestRateByIntervalOptions) (*http.Response, error) { req, err := client.exportRequestRateByIntervalCreateRequest(ctx, location, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.exportRequestRateByIntervalHandleError(resp) } return resp, nil } // exportRequestRateByIntervalCreateRequest creates the ExportRequestRateByInterval request. -func (client *LogAnalyticsClient) exportRequestRateByIntervalCreateRequest(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsBeginExportRequestRateByIntervalOptions) (*azcore.Request, error) { +func (client *LogAnalyticsClient) exportRequestRateByIntervalCreateRequest(ctx context.Context, location string, parameters RequestRateByIntervalInput, options *LogAnalyticsBeginExportRequestRateByIntervalOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -106,97 +82,68 @@ func (client *LogAnalyticsClient) exportRequestRateByIntervalCreateRequest(ctx c return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // exportRequestRateByIntervalHandleError handles the ExportRequestRateByInterval error response. -func (client *LogAnalyticsClient) exportRequestRateByIntervalHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *LogAnalyticsClient) exportRequestRateByIntervalHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginExportThrottledRequests - Export logs that show total throttled Api requests for this subscription in the given time window. // If the operation fails it returns a generic error. -func (client *LogAnalyticsClient) BeginExportThrottledRequests(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsBeginExportThrottledRequestsOptions) (LogAnalyticsOperationResultPollerResponse, error) { +func (client *LogAnalyticsClient) BeginExportThrottledRequests(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsBeginExportThrottledRequestsOptions) (LogAnalyticsExportThrottledRequestsPollerResponse, error) { resp, err := client.exportThrottledRequests(ctx, location, parameters, options) if err != nil { - return LogAnalyticsOperationResultPollerResponse{}, err + return LogAnalyticsExportThrottledRequestsPollerResponse{}, err } - result := LogAnalyticsOperationResultPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("LogAnalyticsClient.ExportThrottledRequests", "azure-async-operation", resp, client.con.Pipeline(), client.exportThrottledRequestsHandleError) - if err != nil { - return LogAnalyticsOperationResultPollerResponse{}, err - } - poller := &logAnalyticsOperationResultPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (LogAnalyticsOperationResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := LogAnalyticsExportThrottledRequestsPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeExportThrottledRequests creates a new LogAnalyticsOperationResultPoller from the specified resume token. -// token - The value must come from a previous call to LogAnalyticsOperationResultPoller.ResumeToken(). -func (client *LogAnalyticsClient) ResumeExportThrottledRequests(ctx context.Context, token string) (LogAnalyticsOperationResultPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("LogAnalyticsClient.ExportThrottledRequests", token, client.con.Pipeline(), client.exportThrottledRequestsHandleError) + pt, err := armruntime.NewPoller("LogAnalyticsClient.ExportThrottledRequests", "azure-async-operation", resp, client.pl, client.exportThrottledRequestsHandleError) if err != nil { - return LogAnalyticsOperationResultPollerResponse{}, err + return LogAnalyticsExportThrottledRequestsPollerResponse{}, err } - poller := &logAnalyticsOperationResultPoller{ + result.Poller = &LogAnalyticsExportThrottledRequestsPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return LogAnalyticsOperationResultPollerResponse{}, err - } - result := LogAnalyticsOperationResultPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (LogAnalyticsOperationResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // ExportThrottledRequests - Export logs that show total throttled Api requests for this subscription in the given time window. // If the operation fails it returns a generic error. -func (client *LogAnalyticsClient) exportThrottledRequests(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsBeginExportThrottledRequestsOptions) (*azcore.Response, error) { +func (client *LogAnalyticsClient) exportThrottledRequests(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsBeginExportThrottledRequestsOptions) (*http.Response, error) { req, err := client.exportThrottledRequestsCreateRequest(ctx, location, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.exportThrottledRequestsHandleError(resp) } return resp, nil } // exportThrottledRequestsCreateRequest creates the ExportThrottledRequests request. -func (client *LogAnalyticsClient) exportThrottledRequestsCreateRequest(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsBeginExportThrottledRequestsOptions) (*azcore.Request, error) { +func (client *LogAnalyticsClient) exportThrottledRequestsCreateRequest(ctx context.Context, location string, parameters ThrottledRequestsInput, options *LogAnalyticsBeginExportThrottledRequestsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -206,26 +153,25 @@ func (client *LogAnalyticsClient) exportThrottledRequestsCreateRequest(ctx conte return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // exportThrottledRequestsHandleError handles the ExportThrottledRequests error response. -func (client *LogAnalyticsClient) exportThrottledRequestsHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *LogAnalyticsClient) exportThrottledRequestsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_models.go b/sdk/compute/armcompute/zz_generated_models.go index fb554ad8863a..766fdf857347 100644 --- a/sdk/compute/armcompute/zz_generated_models.go +++ b/sdk/compute/armcompute/zz_generated_models.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,9 +10,10 @@ package armcompute import ( "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // APIEntityReference - The API entity reference. @@ -69,6 +71,9 @@ type AccessURI struct { // AdditionalCapabilities - Enables or disables a capability on the virtual machine or virtual machine scale set. type AdditionalCapabilities struct { + // The flag that enables or disables hibernation capability on the VM. + HibernationEnabled *bool `json:"hibernationEnabled,omitempty"` + // The flag that enables or disables a capability to have one or more managed data disks with UltraSSDLRS storage account type on the VM or VMSS. Managed // disks with storage account type UltraSSDLRS can // be added to a virtual machine or virtual machine scale set only if this property is enabled. @@ -94,6 +99,19 @@ type AdditionalUnattendContent struct { SettingName *SettingNames `json:"settingName,omitempty"` } +// ApplicationProfile - Contains the list of gallery applications that should be made available to the VM/VMSS +type ApplicationProfile struct { + // Specifies the gallery applications that should be made available to the VM/VMSS + GalleryApplications []*VMGalleryApplication `json:"galleryApplications,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ApplicationProfile. +func (a ApplicationProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "galleryApplications", a.GalleryApplications) + return json.Marshal(objectMap) +} + // AutomaticOSUpgradePolicy - The configuration parameters used for performing automatic OS upgrade. type AutomaticOSUpgradePolicy struct { // Whether OS image rollback feature should be disabled. Default value is false. @@ -384,6 +402,345 @@ type BootDiagnosticsInstanceView struct { Status *InstanceViewStatus `json:"status,omitempty" azure:"ro"` } +// CapacityReservation - Specifies information about the capacity reservation. +type CapacityReservation struct { + Resource + // REQUIRED; SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability + // called 'CapacityReservationSupported' set to true are + // supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + SKU *SKU `json:"sku,omitempty"` + + // Properties of the Capacity reservation. + Properties *CapacityReservationProperties `json:"properties,omitempty"` + + // Availability Zone to use for this capacity reservation. The zone has to be single value and also should be part for the list of zones specified during + // the capacity reservation group creation. The zone + // can be assigned only during creation. If not provided, the reservation supports only non-zonal deployments. If provided, enforces VM/VMSS using this + // capacity reservation to be in same zone. + Zones []*string `json:"zones,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservation. +func (c CapacityReservation) MarshalJSON() ([]byte, error) { + objectMap := c.Resource.marshalInternal() + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// 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. +type CapacityReservationGroup struct { + Resource + // capacity reservation group Properties. + Properties *CapacityReservationGroupProperties `json:"properties,omitempty"` + + // Availability Zones to use for this capacity reservation group. The zones can be assigned only during creation. If not provided, the group supports only + // regional resources in the region. If provided, + // enforces each capacity reservation in the group to be in one of the zones. + Zones []*string `json:"zones,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroup. +func (c CapacityReservationGroup) MarshalJSON() ([]byte, error) { + objectMap := c.Resource.marshalInternal() + populate(objectMap, "properties", c.Properties) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +type CapacityReservationGroupInstanceView struct { + // READ-ONLY; List of instance view of the capacity reservations under the capacity reservation group. + CapacityReservations []*CapacityReservationInstanceViewWithName `json:"capacityReservations,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupInstanceView. +func (c CapacityReservationGroupInstanceView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacityReservations", c.CapacityReservations) + return json.Marshal(objectMap) +} + +// CapacityReservationGroupListResult - The List capacity reservation group with resource group response. +type CapacityReservationGroupListResult struct { + // REQUIRED; The list of capacity reservation groups + Value []*CapacityReservationGroup `json:"value,omitempty"` + + // The URI to fetch the next page of capacity reservation groups. Call ListNext() with this URI to fetch the next page of capacity reservation groups. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupListResult. +func (c CapacityReservationGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// CapacityReservationGroupProperties - capacity reservation group Properties. +type CapacityReservationGroupProperties struct { + // READ-ONLY; A list of all capacity reservation resource ids that belong to capacity reservation group. + CapacityReservations []*SubResourceReadOnly `json:"capacityReservations,omitempty" azure:"ro"` + + // READ-ONLY; The capacity reservation group instance view which has the list of instance views for all the capacity reservations that belong to the capacity + // reservation group. + InstanceView *CapacityReservationGroupInstanceView `json:"instanceView,omitempty" azure:"ro"` + + // READ-ONLY; A list of references to all virtual machines associated to the capacity reservation group. + VirtualMachinesAssociated []*SubResourceReadOnly `json:"virtualMachinesAssociated,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupProperties. +func (c CapacityReservationGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "capacityReservations", c.CapacityReservations) + populate(objectMap, "instanceView", c.InstanceView) + populate(objectMap, "virtualMachinesAssociated", c.VirtualMachinesAssociated) + return json.Marshal(objectMap) +} + +// CapacityReservationGroupUpdate - Specifies information about the capacity reservation group. Only tags can be updated. +type CapacityReservationGroupUpdate struct { + UpdateResource + // capacity reservation group Properties. + Properties *CapacityReservationGroupProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationGroupUpdate. +func (c CapacityReservationGroupUpdate) MarshalJSON() ([]byte, error) { + objectMap := c.UpdateResource.marshalInternal() + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// CapacityReservationGroupsCreateOrUpdateOptions contains the optional parameters for the CapacityReservationGroups.CreateOrUpdate method. +type CapacityReservationGroupsCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// CapacityReservationGroupsDeleteOptions contains the optional parameters for the CapacityReservationGroups.Delete method. +type CapacityReservationGroupsDeleteOptions struct { + // placeholder for future optional parameters +} + +// CapacityReservationGroupsGetOptions contains the optional parameters for the CapacityReservationGroups.Get method. +type CapacityReservationGroupsGetOptions struct { + // The expand expression to apply on the operation. 'InstanceView' will retrieve the list of instance views of the capacity reservations under the capacity + // reservation group which is a snapshot of the runtime properties of a capacity reservation that is managed by the platform and can change outside of control + // plane operations. + Expand *CapacityReservationGroupInstanceViewTypes +} + +// CapacityReservationGroupsListByResourceGroupOptions contains the optional parameters for the CapacityReservationGroups.ListByResourceGroup method. +type CapacityReservationGroupsListByResourceGroupOptions struct { + // The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource + // Ids which are associated to capacity reservation group in the response. + Expand *ExpandTypesForGetCapacityReservationGroups +} + +// CapacityReservationGroupsListBySubscriptionOptions contains the optional parameters for the CapacityReservationGroups.ListBySubscription method. +type CapacityReservationGroupsListBySubscriptionOptions struct { + // The expand expression to apply on the operation. Based on the expand param(s) specified we return Virtual Machine or ScaleSet VM Instance or both resource + // Ids which are associated to capacity reservation group in the response. + Expand *ExpandTypesForGetCapacityReservationGroups +} + +// CapacityReservationGroupsUpdateOptions contains the optional parameters for the CapacityReservationGroups.Update method. +type CapacityReservationGroupsUpdateOptions struct { + // placeholder for future optional parameters +} + +// CapacityReservationInstanceView - The instance view of a capacity reservation that provides as snapshot of the runtime properties of the capacity reservation +// that is managed by the platform and can change outside of control plane +// operations. +type CapacityReservationInstanceView struct { + // The resource status information. + Statuses []*InstanceViewStatus `json:"statuses,omitempty"` + + // Unutilized capacity of the capacity reservation. + UtilizationInfo *CapacityReservationUtilization `json:"utilizationInfo,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationInstanceView. +func (c CapacityReservationInstanceView) MarshalJSON() ([]byte, error) { + objectMap := c.marshalInternal() + return json.Marshal(objectMap) +} + +func (c CapacityReservationInstanceView) marshalInternal() map[string]interface{} { + objectMap := make(map[string]interface{}) + populate(objectMap, "statuses", c.Statuses) + populate(objectMap, "utilizationInfo", c.UtilizationInfo) + return objectMap +} + +// CapacityReservationInstanceViewWithName - The instance view of a capacity reservation that includes the name of the capacity reservation. It is used +// for the response to the instance view of a capacity reservation group. +type CapacityReservationInstanceViewWithName struct { + CapacityReservationInstanceView + // READ-ONLY; The name of the capacity reservation. + Name *string `json:"name,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationInstanceViewWithName. +func (c CapacityReservationInstanceViewWithName) MarshalJSON() ([]byte, error) { + objectMap := c.CapacityReservationInstanceView.marshalInternal() + populate(objectMap, "name", c.Name) + return json.Marshal(objectMap) +} + +// CapacityReservationListResult - The list capacity reservation operation response. +type CapacityReservationListResult struct { + // REQUIRED; The list of capacity reservations + Value []*CapacityReservation `json:"value,omitempty"` + + // The URI to fetch the next page of capacity reservations. Call ListNext() with this URI to fetch the next page of capacity reservations. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationListResult. +func (c CapacityReservationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// CapacityReservationProfile - The parameters of a capacity reservation Profile. +type CapacityReservationProfile struct { + // Specifies the capacity reservation group resource id that should be used for allocating the virtual machine or scaleset vm instances provided enough + // capacity has been reserved. Please refer to + // https://aka.ms/CapacityReservation for more details. + CapacityReservationGroup *SubResource `json:"capacityReservationGroup,omitempty"` +} + +// CapacityReservationProperties - Properties of the Capacity reservation. +type CapacityReservationProperties struct { + // READ-ONLY; The Capacity reservation instance view. + InstanceView *CapacityReservationInstanceView `json:"instanceView,omitempty" azure:"ro"` + + // READ-ONLY; The provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; The date time when the capacity reservation was last updated. + ProvisioningTime *time.Time `json:"provisioningTime,omitempty" azure:"ro"` + + // READ-ONLY; A unique id generated and assigned to the capacity reservation by the platform which does not change throughout the lifetime of the resource. + ReservationID *string `json:"reservationId,omitempty" azure:"ro"` + + // READ-ONLY; A list of all virtual machine resource ids that are associated with the capacity reservation. + VirtualMachinesAssociated []*SubResourceReadOnly `json:"virtualMachinesAssociated,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationProperties. +func (c CapacityReservationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "instanceView", c.InstanceView) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "provisioningTime", (*timeRFC3339)(c.ProvisioningTime)) + populate(objectMap, "reservationId", c.ReservationID) + populate(objectMap, "virtualMachinesAssociated", c.VirtualMachinesAssociated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CapacityReservationProperties. +func (c *CapacityReservationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceView": + err = unpopulate(val, &c.InstanceView) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &c.ProvisioningState) + delete(rawMsg, key) + case "provisioningTime": + var aux timeRFC3339 + err = unpopulate(val, &aux) + c.ProvisioningTime = (*time.Time)(&aux) + delete(rawMsg, key) + case "reservationId": + err = unpopulate(val, &c.ReservationID) + delete(rawMsg, key) + case "virtualMachinesAssociated": + err = unpopulate(val, &c.VirtualMachinesAssociated) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// CapacityReservationUpdate - Specifies information about the capacity reservation. Only tags and sku.capacity can be updated. +type CapacityReservationUpdate struct { + UpdateResource + // Properties of the Capacity reservation. + Properties *CapacityReservationProperties `json:"properties,omitempty"` + + // SKU of the resource for which capacity needs be reserved. The SKU name and capacity is required to be set. Currently VM Skus with the capability called + // 'CapacityReservationSupported' set to true are + // supported. Refer to List Microsoft.Compute SKUs in a region (https://docs.microsoft.com/rest/api/compute/resourceskus/list) for supported values. + SKU *SKU `json:"sku,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationUpdate. +func (c CapacityReservationUpdate) MarshalJSON() ([]byte, error) { + objectMap := c.UpdateResource.marshalInternal() + populate(objectMap, "properties", c.Properties) + populate(objectMap, "sku", c.SKU) + return json.Marshal(objectMap) +} + +// CapacityReservationUtilization - Represents the capacity reservation utilization in terms of resources allocated. +type CapacityReservationUtilization struct { + // READ-ONLY; A list of all virtual machines resource ids allocated against the capacity reservation. + VirtualMachinesAllocated []*SubResourceReadOnly `json:"virtualMachinesAllocated,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type CapacityReservationUtilization. +func (c CapacityReservationUtilization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "virtualMachinesAllocated", c.VirtualMachinesAllocated) + return json.Marshal(objectMap) +} + +// CapacityReservationsBeginCreateOrUpdateOptions contains the optional parameters for the CapacityReservations.BeginCreateOrUpdate method. +type CapacityReservationsBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// CapacityReservationsBeginDeleteOptions contains the optional parameters for the CapacityReservations.BeginDelete method. +type CapacityReservationsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// CapacityReservationsBeginUpdateOptions contains the optional parameters for the CapacityReservations.BeginUpdate method. +type CapacityReservationsBeginUpdateOptions struct { + // placeholder for future optional parameters +} + +// CapacityReservationsGetOptions contains the optional parameters for the CapacityReservations.Get method. +type CapacityReservationsGetOptions struct { + // The expand expression to apply on the operation. 'InstanceView' retrieves a snapshot of the runtime properties of the capacity reservation that is managed + // by the platform and can change outside of control plane operations. + Expand *CapacityReservationInstanceViewTypes +} + +// CapacityReservationsListByCapacityReservationGroupOptions contains the optional parameters for the CapacityReservations.ListByCapacityReservationGroup +// method. +type CapacityReservationsListByCapacityReservationGroupOptions struct { + // placeholder for future optional parameters +} + // CloudError - An error response from the Compute service. // Implements the error and azcore.HTTPResponse interfaces. type CloudError struct { @@ -2054,6 +2411,16 @@ type DiskRestorePoint struct { Properties *DiskRestorePointProperties `json:"properties,omitempty"` } +// DiskRestorePointBeginGrantAccessOptions contains the optional parameters for the DiskRestorePoint.BeginGrantAccess method. +type DiskRestorePointBeginGrantAccessOptions struct { + // placeholder for future optional parameters +} + +// DiskRestorePointBeginRevokeAccessOptions contains the optional parameters for the DiskRestorePoint.BeginRevokeAccess method. +type DiskRestorePointBeginRevokeAccessOptions struct { + // placeholder for future optional parameters +} + // DiskRestorePointGetOptions contains the optional parameters for the DiskRestorePoint.Get method. type DiskRestorePointGetOptions struct { // placeholder for future optional parameters @@ -2802,6 +3169,9 @@ type GalleryArtifactPublishingProfileBase struct { // This property is updatable. ReplicaCount *int32 `json:"replicaCount,omitempty"` + // Optional parameter which specifies the mode to be used for replication. This property is not updatable. + ReplicationMode *ReplicationMode `json:"replicationMode,omitempty"` + // Specifies the storage account type to be used to store the image. This property is not updatable. StorageAccountType *StorageAccountType `json:"storageAccountType,omitempty"` @@ -2833,6 +3203,7 @@ func (g GalleryArtifactPublishingProfileBase) marshalInternal() map[string]inter populate(objectMap, "excludeFromLatest", g.ExcludeFromLatest) populate(objectMap, "publishedDate", (*timeRFC3339)(g.PublishedDate)) populate(objectMap, "replicaCount", g.ReplicaCount) + populate(objectMap, "replicationMode", g.ReplicationMode) populate(objectMap, "storageAccountType", g.StorageAccountType) populate(objectMap, "targetRegions", g.TargetRegions) return objectMap @@ -2858,6 +3229,9 @@ func (g *GalleryArtifactPublishingProfileBase) unmarshalInternal(rawMsg map[stri case "replicaCount": err = unpopulate(val, &g.ReplicaCount) delete(rawMsg, key) + case "replicationMode": + err = unpopulate(val, &g.ReplicationMode) + delete(rawMsg, key) case "storageAccountType": err = unpopulate(val, &g.StorageAccountType) delete(rawMsg, key) @@ -3279,6 +3653,9 @@ type GalleryProperties struct { // Profile for gallery sharing to subscription or tenant SharingProfile *SharingProfile `json:"sharingProfile,omitempty"` + // Contains information about the soft deletion policy of the gallery. + SoftDeletePolicy *SoftDeletePolicy `json:"softDeletePolicy,omitempty"` + // READ-ONLY; The provisioning state, which only appears in the response. ProvisioningState *GalleryPropertiesProvisioningState `json:"provisioningState,omitempty" azure:"ro"` } @@ -3323,6 +3700,11 @@ type HardwareProfile struct { // virtual machines [https://docs.microsoft.com/azure/virtual-machines/sizes]. // The available VM sizes depend on region and availability set. VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + + // 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 `json:"vmSizeProperties,omitempty"` } // Image - The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is @@ -3467,6 +3849,9 @@ type ImageReference struct { // The image SKU. SKU *string `json:"sku,omitempty"` + // Specified the shared gallery image unique id for vm deployment. This can be fetched from shared gallery image GET call. + SharedGalleryImageID *string `json:"sharedGalleryImageId,omitempty"` + // Specifies the version of the platform image or marketplace image used to create the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. // Major, Minor, and Build are decimal numbers. // Specify 'latest' to use the latest version of an image available at deploy time. Even if you use 'latest', the VM image will not automatically update @@ -3487,6 +3872,7 @@ func (i ImageReference) MarshalJSON() ([]byte, error) { populate(objectMap, "offer", i.Offer) populate(objectMap, "publisher", i.Publisher) populate(objectMap, "sku", i.SKU) + populate(objectMap, "sharedGalleryImageId", i.SharedGalleryImageID) populate(objectMap, "version", i.Version) return json.Marshal(objectMap) } @@ -4383,7 +4769,10 @@ type OSProfile struct { // to false. RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` - // Specifies set of certificates that should be installed onto the virtual machine. + // Specifies set of certificates that should be installed onto the virtual machine. To install certificates on a virtual machine it is recommended to use + // the Azure Key Vault virtual machine extension for + // Linux [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure Key Vault virtual machine extension for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. Secrets []*VaultSecretGroup `json:"secrets,omitempty"` // Specifies Windows operating system settings on the virtual machine. @@ -4828,27 +5217,13 @@ type ProxyResource struct { Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := p.marshalInternal() - return json.Marshal(objectMap) -} - -func (p ProxyResource) marshalInternal() map[string]interface{} { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return objectMap -} - // PublicIPAddressSKU - Describes the public IP Sku type PublicIPAddressSKU struct { - // REQUIRED; Specify public IP sku name - PublicIPAddressSKUName *PublicIPAddressSKUName `json:"publicIPAddressSkuName,omitempty"` + // Specify public IP sku name + Name *PublicIPAddressSKUName `json:"name,omitempty"` // Specify public IP sku tier - PublicIPAddressSKUTier *PublicIPAddressSKUTier `json:"publicIPAddressSkuTier,omitempty"` + Tier *PublicIPAddressSKUTier `json:"tier,omitempty"` } // PurchasePlan - Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. @@ -5153,10 +5528,17 @@ type ResourceSKUCosts struct { Quantity *int64 `json:"quantity,omitempty" azure:"ro"` } +// ResourceSKULocationInfo - Describes an available Compute SKU Location Information. type ResourceSKULocationInfo struct { + // READ-ONLY; The names of extended locations. + ExtendedLocations []*string `json:"extendedLocations,omitempty" azure:"ro"` + // READ-ONLY; Location of the SKU Location *string `json:"location,omitempty" azure:"ro"` + // READ-ONLY; The type of the extended location. + Type *ExtendedLocationType `json:"type,omitempty" azure:"ro"` + // READ-ONLY; Details of capabilities available to a SKU in specific zones. ZoneDetails []*ResourceSKUZoneDetails `json:"zoneDetails,omitempty" azure:"ro"` @@ -5167,12 +5549,15 @@ type ResourceSKULocationInfo struct { // MarshalJSON implements the json.Marshaller interface for type ResourceSKULocationInfo. func (r ResourceSKULocationInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "extendedLocations", r.ExtendedLocations) populate(objectMap, "location", r.Location) + populate(objectMap, "type", r.Type) populate(objectMap, "zoneDetails", r.ZoneDetails) populate(objectMap, "zones", r.Zones) return json.Marshal(objectMap) } +// ResourceSKURestrictionInfo - Describes an available Compute SKU Restriction Information. type ResourceSKURestrictionInfo struct { // READ-ONLY; Locations where the SKU is restricted Locations []*string `json:"locations,omitempty" azure:"ro"` @@ -5235,6 +5620,8 @@ func (r ResourceSKUZoneDetails) MarshalJSON() ([]byte, error) { type ResourceSKUsListOptions struct { // The filter to apply on the operation. Only **location** filter is supported currently. Filter *string + // To Include Extended Locations information or not in the response. + IncludeExtendedLocations *string } // ResourceSKUsResult - The List Resource Skus operation response. @@ -5274,31 +5661,8 @@ func (r ResourceURIList) MarshalJSON() ([]byte, error) { // RestorePoint - Restore Point details. type RestorePoint struct { ProxyResource - // List of disk resource ids that the customer wishes to exclude from the restore point. If no disks are specified, all disks will be included. - ExcludeDisks []*APIEntityReference `json:"excludeDisks,omitempty"` - - // READ-ONLY; Gets the consistency mode for the restore point. Please refer to https://aka.ms/RestorePoints for more details. - ConsistencyMode *ConsistencyModeTypes `json:"consistencyMode,omitempty" azure:"ro"` - - // READ-ONLY; Gets the provisioning details set by the server during Create restore point operation. - ProvisioningDetails *RestorePointProvisioningDetails `json:"provisioningDetails,omitempty" azure:"ro"` - - // READ-ONLY; Gets the provisioning state of the restore point. - ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` - - // READ-ONLY; Gets the details of the VM captured at the time of the restore point creation. - SourceMetadata *RestorePointSourceMetadata `json:"sourceMetadata,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type RestorePoint. -func (r RestorePoint) MarshalJSON() ([]byte, error) { - objectMap := r.ProxyResource.marshalInternal() - populate(objectMap, "consistencyMode", r.ConsistencyMode) - populate(objectMap, "excludeDisks", r.ExcludeDisks) - populate(objectMap, "provisioningDetails", r.ProvisioningDetails) - populate(objectMap, "provisioningState", r.ProvisioningState) - populate(objectMap, "sourceMetadata", r.SourceMetadata) - return json.Marshal(objectMap) + // The restore point properties. + Properties *RestorePointProperties `json:"properties,omitempty"` } // RestorePointCollection - Create or update Restore Point collection parameters. @@ -5411,6 +5775,35 @@ type RestorePointCollectionsUpdateOptions struct { // placeholder for future optional parameters } +// RestorePointProperties - The restore point properties. +type RestorePointProperties struct { + // List of disk resource ids that the customer wishes to exclude from the restore point. If no disks are specified, all disks will be included. + ExcludeDisks []*APIEntityReference `json:"excludeDisks,omitempty"` + + // READ-ONLY; Gets the consistency mode for the restore point. Please refer to https://aka.ms/RestorePoints for more details. + ConsistencyMode *ConsistencyModeTypes `json:"consistencyMode,omitempty" azure:"ro"` + + // READ-ONLY; Gets the provisioning details set by the server during Create restore point operation. + ProvisioningDetails *RestorePointProvisioningDetails `json:"provisioningDetails,omitempty" azure:"ro"` + + // READ-ONLY; Gets the provisioning state of the restore point. + ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Gets the details of the VM captured at the time of the restore point creation. + SourceMetadata *RestorePointSourceMetadata `json:"sourceMetadata,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type RestorePointProperties. +func (r RestorePointProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "consistencyMode", r.ConsistencyMode) + populate(objectMap, "excludeDisks", r.ExcludeDisks) + populate(objectMap, "provisioningDetails", r.ProvisioningDetails) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "sourceMetadata", r.SourceMetadata) + return json.Marshal(objectMap) +} + // RestorePointProvisioningDetails - Restore Point Provisioning details. type RestorePointProvisioningDetails struct { // Gets the creation time of the restore point. @@ -5480,6 +5873,9 @@ type RestorePointSourceMetadata struct { // Gets the license type, which is for bring your own license scenario. LicenseType *string `json:"licenseType,omitempty"` + // Location of the VM from which the restore point was created. + Location *string `json:"location,omitempty"` + // Gets the OS profile. OSProfile *OSProfile `json:"osProfile,omitempty"` @@ -6102,6 +6498,10 @@ type SSHPublicKeysUpdateOptions struct { // ScaleInPolicy - Describes a scale-in policy for a virtual machine scale set. type ScaleInPolicy struct { + // This property allows you to specify if virtual machines chosen for removal have to be force deleted when a virtual machine scale set is being scaled-in.(Feature + // in Preview) + ForceDeletion *bool `json:"forceDeletion,omitempty"` + // The rules to be followed when scaling-in a virtual machine scale set. // Possible values are: // Default When a virtual machine scale set is scaled in, the scale set will first be balanced across zones if it is a zonal scale set. Then, it will be @@ -6119,6 +6519,7 @@ type ScaleInPolicy struct { // MarshalJSON implements the json.Marshaller interface for type ScaleInPolicy. func (s ScaleInPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "forceDeletion", s.ForceDeletion) populate(objectMap, "rules", s.Rules) return json.Marshal(objectMap) } @@ -6138,7 +6539,7 @@ type SecurityProfile struct { // Specifies the SecurityType of the virtual machine. It is set as TrustedLaunch to enable UefiSettings. // Default: UefiSettings will not be enabled unless this property is set as TrustedLaunch. - SecurityType *string `json:"securityType,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` // Specifies the security settings like secure boot and vTPM used while creating the virtual machine. // Minimum api-version: 2020-12-01 @@ -6745,12 +7146,30 @@ type SnapshotsListOptions struct { // placeholder for future optional parameters } +// SoftDeletePolicy - Contains information about the soft deletion policy of the gallery. +type SoftDeletePolicy struct { + // Enables soft-deletion for resources in this gallery, allowing them to be recovered within retention time. + IsSoftDeleteEnabled *bool `json:"isSoftDeleteEnabled,omitempty"` +} + // SourceVault - The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName} type SourceVault struct { // Resource Id ID *string `json:"id,omitempty"` } +// 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 on capacity availability + // and pricing constraints + Enabled *bool `json:"enabled,omitempty"` + + // Timeout value expressed as an ISO 8601 time duration after which the platform will not try to restore the VMSS SPOT instances + RestoreTimeout *string `json:"restoreTimeout,omitempty"` +} + type StatusCodeCount struct { // READ-ONLY; The instance view status code Code *string `json:"code,omitempty" azure:"ro"` @@ -7102,6 +7521,22 @@ type UserAssignedIdentitiesValue struct { PrincipalID *string `json:"principalId,omitempty" azure:"ro"` } +// VMGalleryApplication - Specifies the required information to reference a compute gallery application version +type VMGalleryApplication struct { + // REQUIRED; Specifies the GalleryApplicationVersion resource id on the form of + // /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version} + PackageReferenceID *string `json:"packageReferenceId,omitempty"` + + // Optional, Specifies the uri to an azure blob that will replace the default configuration for the package if provided + ConfigurationReference *string `json:"configurationReference,omitempty"` + + // Optional, Specifies the order in which the packages have to be installed + Order *int32 `json:"order,omitempty"` + + // Optional, Specifies a passthrough value for more generic context. + Tags *string `json:"tags,omitempty"` +} + type VMScaleSetConvertToSinglePlacementGroupInput struct { // Id of the placement group in which you want future virtual machine instances to be placed. To query placement group Id, please use Virtual Machine Scale // Set VMs - Get API. If not provided, the @@ -7109,6 +7544,22 @@ type VMScaleSetConvertToSinglePlacementGroupInput struct { ActivePlacementGroupID *string `json:"activePlacementGroupId,omitempty"` } +// 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] . + VCPUsAvailable *int32 `json:"vCPUsAvailable,omitempty"` + + // 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 `json:"vCPUsPerCore,omitempty"` +} + // VaultCertificate - Describes a single certificate reference in a Key Vault, and where the certificate should reside on 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 @@ -7127,6 +7578,9 @@ type VaultCertificate struct { // "dataType":"pfx", // "password":"" // } + // To install certificates on a virtual machine it is recommended to use the Azure Key Vault virtual machine extension for Linux + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure Key Vault virtual machine extension for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. CertificateURL *string `json:"certificateUrl,omitempty"` } @@ -7469,6 +7923,10 @@ type VirtualMachineExtensionProperties struct { // Json formatted public settings for the extension. Settings map[string]interface{} `json:"settings,omitempty"` + // Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed + // regardless of this value). The default is false. + SuppressFailures *bool `json:"suppressFailures,omitempty"` + // Specifies the type of the extension; an example is "CustomScriptExtension". Type *string `json:"type,omitempty"` @@ -7515,6 +7973,10 @@ type VirtualMachineExtensionUpdateProperties struct { // Json formatted public settings for the extension. Settings map[string]interface{} `json:"settings,omitempty"` + // Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed + // regardless of this value). The default is false. + SuppressFailures *bool `json:"suppressFailures,omitempty"` + // Specifies the type of the extension; an example is "CustomScriptExtension". Type *string `json:"type,omitempty"` @@ -7753,15 +8215,15 @@ type VirtualMachineImagesListSKUsOptions struct { // VirtualMachineInstallPatchesParameters - Input for InstallPatches as directly received by the API type VirtualMachineInstallPatchesParameters struct { - // REQUIRED; Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours) - MaximumDuration *string `json:"maximumDuration,omitempty"` - // REQUIRED; Defines when it is acceptable to reboot a VM during a software update operation. RebootSetting *VMGuestPatchRebootSetting `json:"rebootSetting,omitempty"` // Input for InstallPatches on a Linux VM, as directly received by the API LinuxParameters *LinuxParameters `json:"linuxParameters,omitempty"` + // Specifies the maximum amount of time that the operation will run. It must be an ISO 8601-compliant duration string such as PT4H (4 hours) + MaximumDuration *string `json:"maximumDuration,omitempty"` + // Input for InstallPatches on a Windows VM, as directly received by the API WindowsParameters *WindowsParameters `json:"windowsParameters,omitempty"` } @@ -8117,6 +8579,9 @@ type VirtualMachineProperties struct { // Specifies additional capabilities enabled or disabled on the virtual machine. AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + // Specifies the gallery applications that should be made available to the VM/VMSS + ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"` + // 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]. @@ -8131,6 +8596,10 @@ type VirtualMachineProperties struct { // Minimum api-version: 2019-03-01. BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + // Specifies information about the capacity reservation that is used to allocate virtual machine. + // Minimum api-version: 2021-04-01. + CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"` + // Specifies the boot diagnostic settings state. // Minimum api-version: 2015-06-15. DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` @@ -8696,6 +9165,10 @@ type VirtualMachineScaleSetExtensionProperties struct { // Json formatted public settings for the extension. Settings map[string]interface{} `json:"settings,omitempty"` + // Indicates whether failures stemming from the extension will be suppressed (Operational failures such as not connecting to the VM will not be suppressed + // regardless of this value). The default is false. + SuppressFailures *bool `json:"suppressFailures,omitempty"` + // Specifies the type of the extension; an example is "CustomScriptExtension". Type *string `json:"type,omitempty"` @@ -8717,6 +9190,7 @@ func (v VirtualMachineScaleSetExtensionProperties) MarshalJSON() ([]byte, error) populate(objectMap, "provisioningState", v.ProvisioningState) populate(objectMap, "publisher", v.Publisher) populate(objectMap, "settings", v.Settings) + populate(objectMap, "suppressFailures", v.SuppressFailures) populate(objectMap, "type", v.Type) populate(objectMap, "typeHandlerVersion", v.TypeHandlerVersion) return json.Marshal(objectMap) @@ -9195,7 +9669,11 @@ type VirtualMachineScaleSetOSProfile struct { // 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 `json:"linuxConfiguration,omitempty"` - // Specifies set of certificates that should be installed onto the virtual machines in the scale set. + // Specifies set of certificates that should be installed onto the virtual machines in the scale set. To install certificates on a virtual machine it is + // recommended to use the Azure Key Vault virtual + // machine extension for Linux [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure Key Vault virtual machine extension + // for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. Secrets []*VaultSecretGroup `json:"secrets,omitempty"` // Specifies Windows operating system settings on the virtual machine. @@ -9247,7 +9725,7 @@ type VirtualMachineScaleSetProperties struct { // Minimum api-version: 2018-04-01. ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` - // Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in. + // Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale Set. ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` // When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified @@ -9255,13 +9733,18 @@ type VirtualMachineScaleSetProperties struct { // is false, it may not be modified to true. SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + // Specifies the Spot Restore properties for the virtual machine scale set. + SpotRestorePolicy *SpotRestorePolicy `json:"spotRestorePolicy,omitempty"` + // The upgrade policy. UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` // The virtual machine profile. VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` - // Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. + // Whether to force strictly even Virtual Machine distribution cross x-zones in case there is zone outage. zoneBalance property can only be set if the zones + // property of the scale set contains more than + // one zone. If there are no zones or only one zone specified, then zoneBalance property should not be set. ZoneBalance *bool `json:"zoneBalance,omitempty"` // READ-ONLY; The provisioning state, which only appears in the response. @@ -9668,7 +10151,7 @@ type VirtualMachineScaleSetUpdateProperties struct { // Minimum api-version: 2018-04-01. ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` - // Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in. + // Specifies the policies applied when scaling in Virtual Machines in the Virtual Machine Scale Set. ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` // When true this limits the scale set to a single placement group, of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified @@ -10021,10 +10504,17 @@ func (v VirtualMachineScaleSetVMNetworkProfileConfiguration) MarshalJSON() ([]by // VirtualMachineScaleSetVMProfile - Describes a virtual machine scale set virtual machine profile. type VirtualMachineScaleSetVMProfile struct { + // Specifies the gallery applications that should be made available to the VM/VMSS + ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"` + // Specifies the billing related details of a Azure Spot VMSS. // Minimum api-version: 2019-03-01. BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + // Specifies the capacity reservation related details of a scale set. + // Minimum api-version: 2021-04-01. + CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"` + // Specifies the boot diagnostic settings state. // Minimum api-version: 2015-06-15. DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` @@ -10623,7 +11113,8 @@ type VirtualMachinesBeginCreateOrUpdateOptions struct { // VirtualMachinesBeginDeallocateOptions contains the optional parameters for the VirtualMachines.BeginDeallocate method. type VirtualMachinesBeginDeallocateOptions struct { - // placeholder for future optional parameters + // Optional parameter to hibernate a virtual machine. (Feature in Preview) + Hibernate *bool } // VirtualMachinesBeginDeleteOptions contains the optional parameters for the VirtualMachines.BeginDelete method. @@ -10760,6 +11251,9 @@ type WinRMListener struct { // "dataType":"pfx", // "password":"" // } + // To install certificates on a virtual machine it is recommended to use the Azure Key Vault virtual machine extension for Linux + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux] or the Azure Key Vault virtual machine extension for Windows + // [https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows]. CertificateURL *string `json:"certificateUrl,omitempty"` // Specifies the protocol of WinRM listener. diff --git a/sdk/compute/armcompute/zz_generated_operations_client.go b/sdk/compute/armcompute/zz_generated_operations_client.go index 73e8d8611420..d83914f91b1f 100644 --- a/sdk/compute/armcompute/zz_generated_operations_client.go +++ b/sdk/compute/armcompute/zz_generated_operations_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,71 +11,73 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // OperationsClient contains the methods for the Operations group. // Don't use this type directly, use NewOperationsClient() instead. type OperationsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *armcore.Connection) *OperationsClient { - return &OperationsClient{con: con} +func NewOperationsClient(con *arm.Connection) *OperationsClient { + return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} } // List - Gets a list of compute operations. // If the operation fails it returns a generic error. -func (client *OperationsClient) List(ctx context.Context, options *OperationsListOptions) (ComputeOperationListResultResponse, error) { +func (client *OperationsClient) List(ctx context.Context, options *OperationsListOptions) (OperationsListResponse, error) { req, err := client.listCreateRequest(ctx, options) if err != nil { - return ComputeOperationListResultResponse{}, err + return OperationsListResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return ComputeOperationListResultResponse{}, err + return OperationsListResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return ComputeOperationListResultResponse{}, client.listHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsListResponse{}, client.listHandleError(resp) } return client.listHandleResponse(resp) } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*azcore.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Compute/operations" - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *OperationsClient) listHandleResponse(resp *azcore.Response) (ComputeOperationListResultResponse, error) { - var val *ComputeOperationListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ComputeOperationListResultResponse{}, err +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { + result := OperationsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ComputeOperationListResult); err != nil { + return OperationsListResponse{}, err } - return ComputeOperationListResultResponse{RawResponse: resp.Response, ComputeOperationListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *OperationsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *OperationsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_pagers.go b/sdk/compute/armcompute/zz_generated_pagers.go index 02b0dbf6c745..e280dfa0251a 100644 --- a/sdk/compute/armcompute/zz_generated_pagers.go +++ b/sdk/compute/armcompute/zz_generated_pagers.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,51 +10,31 @@ package armcompute import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" "reflect" -) - -// AvailabilitySetListResultPager provides iteration over AvailabilitySetListResult pages. -type AvailabilitySetListResultPager interface { - azcore.Pager - - // PageResponse returns the current AvailabilitySetListResultResponse. - PageResponse() AvailabilitySetListResultResponse -} -type availabilitySetListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type availabilitySetListResultHandleError func(*azcore.Response) error - -type availabilitySetListResultHandleResponse func(*azcore.Response) (AvailabilitySetListResultResponse, error) - -type availabilitySetListResultAdvancePage func(context.Context, AvailabilitySetListResultResponse) (*azcore.Request, error) + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" +) -type availabilitySetListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester availabilitySetListResultCreateRequest - // callback for handling response errors - errorer availabilitySetListResultHandleError - // callback for handling the HTTP response - responder availabilitySetListResultHandleResponse - // callback for advancing to the next page - advancer availabilitySetListResultAdvancePage - // contains the current response - current AvailabilitySetListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// AvailabilitySetsListBySubscriptionPager provides operations for iterating over paged responses. +type AvailabilitySetsListBySubscriptionPager struct { + client *AvailabilitySetsClient + current AvailabilitySetsListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AvailabilitySetsListBySubscriptionResponse) (*policy.Request, error) } -func (p *availabilitySetListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *AvailabilitySetsListBySubscriptionPager) Err() error { return p.err } -func (p *availabilitySetListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *AvailabilitySetsListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.AvailabilitySetListResult.NextLink == nil || len(*p.current.AvailabilitySetListResult.NextLink) == 0 { @@ -67,16 +48,16 @@ func (p *availabilitySetListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listBySubscriptionHandleResponse(resp) if err != nil { p.err = err return false @@ -85,54 +66,32 @@ func (p *availabilitySetListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *availabilitySetListResultPager) PageResponse() AvailabilitySetListResultResponse { +// PageResponse returns the current AvailabilitySetsListBySubscriptionResponse page. +func (p *AvailabilitySetsListBySubscriptionPager) PageResponse() AvailabilitySetsListBySubscriptionResponse { return p.current } -// CloudServiceListResultPager provides iteration over CloudServiceListResult pages. -type CloudServiceListResultPager interface { - azcore.Pager - - // PageResponse returns the current CloudServiceListResultResponse. - PageResponse() CloudServiceListResultResponse -} - -type cloudServiceListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type cloudServiceListResultHandleError func(*azcore.Response) error - -type cloudServiceListResultHandleResponse func(*azcore.Response) (CloudServiceListResultResponse, error) - -type cloudServiceListResultAdvancePage func(context.Context, CloudServiceListResultResponse) (*azcore.Request, error) - -type cloudServiceListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester cloudServiceListResultCreateRequest - // callback for handling response errors - errorer cloudServiceListResultHandleError - // callback for handling the HTTP response - responder cloudServiceListResultHandleResponse - // callback for advancing to the next page - advancer cloudServiceListResultAdvancePage - // contains the current response - current CloudServiceListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// AvailabilitySetsListPager provides operations for iterating over paged responses. +type AvailabilitySetsListPager struct { + client *AvailabilitySetsClient + current AvailabilitySetsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, AvailabilitySetsListResponse) (*policy.Request, error) } -func (p *cloudServiceListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *AvailabilitySetsListPager) Err() error { return p.err } -func (p *cloudServiceListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *AvailabilitySetsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.CloudServiceListResult.NextLink == nil || len(*p.current.CloudServiceListResult.NextLink) == 0 { + if p.current.AvailabilitySetListResult.NextLink == nil || len(*p.current.AvailabilitySetListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -143,16 +102,16 @@ func (p *cloudServiceListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -161,54 +120,32 @@ func (p *cloudServiceListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *cloudServiceListResultPager) PageResponse() CloudServiceListResultResponse { +// PageResponse returns the current AvailabilitySetsListResponse page. +func (p *AvailabilitySetsListPager) PageResponse() AvailabilitySetsListResponse { return p.current } -// CloudServiceRoleListResultPager provides iteration over CloudServiceRoleListResult pages. -type CloudServiceRoleListResultPager interface { - azcore.Pager - - // PageResponse returns the current CloudServiceRoleListResultResponse. - PageResponse() CloudServiceRoleListResultResponse -} - -type cloudServiceRoleListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type cloudServiceRoleListResultHandleError func(*azcore.Response) error - -type cloudServiceRoleListResultHandleResponse func(*azcore.Response) (CloudServiceRoleListResultResponse, error) - -type cloudServiceRoleListResultAdvancePage func(context.Context, CloudServiceRoleListResultResponse) (*azcore.Request, error) - -type cloudServiceRoleListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester cloudServiceRoleListResultCreateRequest - // callback for handling response errors - errorer cloudServiceRoleListResultHandleError - // callback for handling the HTTP response - responder cloudServiceRoleListResultHandleResponse - // callback for advancing to the next page - advancer cloudServiceRoleListResultAdvancePage - // contains the current response - current CloudServiceRoleListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// CapacityReservationGroupsListByResourceGroupPager provides operations for iterating over paged responses. +type CapacityReservationGroupsListByResourceGroupPager struct { + client *CapacityReservationGroupsClient + current CapacityReservationGroupsListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CapacityReservationGroupsListByResourceGroupResponse) (*policy.Request, error) } -func (p *cloudServiceRoleListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *CapacityReservationGroupsListByResourceGroupPager) Err() error { return p.err } -func (p *cloudServiceRoleListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CapacityReservationGroupsListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.CloudServiceRoleListResult.NextLink == nil || len(*p.current.CloudServiceRoleListResult.NextLink) == 0 { + if p.current.CapacityReservationGroupListResult.NextLink == nil || len(*p.current.CapacityReservationGroupListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -219,16 +156,16 @@ func (p *cloudServiceRoleListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByResourceGroupHandleResponse(resp) if err != nil { p.err = err return false @@ -237,54 +174,32 @@ func (p *cloudServiceRoleListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *cloudServiceRoleListResultPager) PageResponse() CloudServiceRoleListResultResponse { +// PageResponse returns the current CapacityReservationGroupsListByResourceGroupResponse page. +func (p *CapacityReservationGroupsListByResourceGroupPager) PageResponse() CapacityReservationGroupsListByResourceGroupResponse { return p.current } -// DedicatedHostGroupListResultPager provides iteration over DedicatedHostGroupListResult pages. -type DedicatedHostGroupListResultPager interface { - azcore.Pager - - // PageResponse returns the current DedicatedHostGroupListResultResponse. - PageResponse() DedicatedHostGroupListResultResponse -} - -type dedicatedHostGroupListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type dedicatedHostGroupListResultHandleError func(*azcore.Response) error - -type dedicatedHostGroupListResultHandleResponse func(*azcore.Response) (DedicatedHostGroupListResultResponse, error) - -type dedicatedHostGroupListResultAdvancePage func(context.Context, DedicatedHostGroupListResultResponse) (*azcore.Request, error) - -type dedicatedHostGroupListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester dedicatedHostGroupListResultCreateRequest - // callback for handling response errors - errorer dedicatedHostGroupListResultHandleError - // callback for handling the HTTP response - responder dedicatedHostGroupListResultHandleResponse - // callback for advancing to the next page - advancer dedicatedHostGroupListResultAdvancePage - // contains the current response - current DedicatedHostGroupListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// CapacityReservationGroupsListBySubscriptionPager provides operations for iterating over paged responses. +type CapacityReservationGroupsListBySubscriptionPager struct { + client *CapacityReservationGroupsClient + current CapacityReservationGroupsListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CapacityReservationGroupsListBySubscriptionResponse) (*policy.Request, error) } -func (p *dedicatedHostGroupListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *CapacityReservationGroupsListBySubscriptionPager) Err() error { return p.err } -func (p *dedicatedHostGroupListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CapacityReservationGroupsListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.DedicatedHostGroupListResult.NextLink == nil || len(*p.current.DedicatedHostGroupListResult.NextLink) == 0 { + if p.current.CapacityReservationGroupListResult.NextLink == nil || len(*p.current.CapacityReservationGroupListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -295,16 +210,16 @@ func (p *dedicatedHostGroupListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listBySubscriptionHandleResponse(resp) if err != nil { p.err = err return false @@ -313,54 +228,32 @@ func (p *dedicatedHostGroupListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *dedicatedHostGroupListResultPager) PageResponse() DedicatedHostGroupListResultResponse { +// PageResponse returns the current CapacityReservationGroupsListBySubscriptionResponse page. +func (p *CapacityReservationGroupsListBySubscriptionPager) PageResponse() CapacityReservationGroupsListBySubscriptionResponse { return p.current } -// DedicatedHostListResultPager provides iteration over DedicatedHostListResult pages. -type DedicatedHostListResultPager interface { - azcore.Pager - - // PageResponse returns the current DedicatedHostListResultResponse. - PageResponse() DedicatedHostListResultResponse -} - -type dedicatedHostListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type dedicatedHostListResultHandleError func(*azcore.Response) error - -type dedicatedHostListResultHandleResponse func(*azcore.Response) (DedicatedHostListResultResponse, error) - -type dedicatedHostListResultAdvancePage func(context.Context, DedicatedHostListResultResponse) (*azcore.Request, error) - -type dedicatedHostListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester dedicatedHostListResultCreateRequest - // callback for handling response errors - errorer dedicatedHostListResultHandleError - // callback for handling the HTTP response - responder dedicatedHostListResultHandleResponse - // callback for advancing to the next page - advancer dedicatedHostListResultAdvancePage - // contains the current response - current DedicatedHostListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// CapacityReservationsListByCapacityReservationGroupPager provides operations for iterating over paged responses. +type CapacityReservationsListByCapacityReservationGroupPager struct { + client *CapacityReservationsClient + current CapacityReservationsListByCapacityReservationGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CapacityReservationsListByCapacityReservationGroupResponse) (*policy.Request, error) } -func (p *dedicatedHostListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *CapacityReservationsListByCapacityReservationGroupPager) Err() error { return p.err } -func (p *dedicatedHostListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CapacityReservationsListByCapacityReservationGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.DedicatedHostListResult.NextLink == nil || len(*p.current.DedicatedHostListResult.NextLink) == 0 { + if p.current.CapacityReservationListResult.NextLink == nil || len(*p.current.CapacityReservationListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -371,16 +264,16 @@ func (p *dedicatedHostListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByCapacityReservationGroupHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByCapacityReservationGroupHandleResponse(resp) if err != nil { p.err = err return false @@ -389,54 +282,32 @@ func (p *dedicatedHostListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *dedicatedHostListResultPager) PageResponse() DedicatedHostListResultResponse { +// PageResponse returns the current CapacityReservationsListByCapacityReservationGroupResponse page. +func (p *CapacityReservationsListByCapacityReservationGroupPager) PageResponse() CapacityReservationsListByCapacityReservationGroupResponse { return p.current } -// DiskAccessListPager provides iteration over DiskAccessList pages. -type DiskAccessListPager interface { - azcore.Pager - - // PageResponse returns the current DiskAccessListResponse. - PageResponse() DiskAccessListResponse -} - -type diskAccessListCreateRequest func(context.Context) (*azcore.Request, error) - -type diskAccessListHandleError func(*azcore.Response) error - -type diskAccessListHandleResponse func(*azcore.Response) (DiskAccessListResponse, error) - -type diskAccessListAdvancePage func(context.Context, DiskAccessListResponse) (*azcore.Request, error) - -type diskAccessListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester diskAccessListCreateRequest - // callback for handling response errors - errorer diskAccessListHandleError - // callback for handling the HTTP response - responder diskAccessListHandleResponse - // callback for advancing to the next page - advancer diskAccessListAdvancePage - // contains the current response - current DiskAccessListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// CloudServiceOperatingSystemsListOSFamiliesPager provides operations for iterating over paged responses. +type CloudServiceOperatingSystemsListOSFamiliesPager struct { + client *CloudServiceOperatingSystemsClient + current CloudServiceOperatingSystemsListOSFamiliesResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CloudServiceOperatingSystemsListOSFamiliesResponse) (*policy.Request, error) } -func (p *diskAccessListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *CloudServiceOperatingSystemsListOSFamiliesPager) Err() error { return p.err } -func (p *diskAccessListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CloudServiceOperatingSystemsListOSFamiliesPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.DiskAccessList.NextLink == nil || len(*p.current.DiskAccessList.NextLink) == 0 { + if p.current.OSFamilyListResult.NextLink == nil || len(*p.current.OSFamilyListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -447,16 +318,16 @@ func (p *diskAccessListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listOSFamiliesHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listOSFamiliesHandleResponse(resp) if err != nil { p.err = err return false @@ -465,54 +336,32 @@ func (p *diskAccessListPager) NextPage(ctx context.Context) bool { return true } -func (p *diskAccessListPager) PageResponse() DiskAccessListResponse { +// PageResponse returns the current CloudServiceOperatingSystemsListOSFamiliesResponse page. +func (p *CloudServiceOperatingSystemsListOSFamiliesPager) PageResponse() CloudServiceOperatingSystemsListOSFamiliesResponse { return p.current } -// DiskEncryptionSetListPager provides iteration over DiskEncryptionSetList pages. -type DiskEncryptionSetListPager interface { - azcore.Pager - - // PageResponse returns the current DiskEncryptionSetListResponse. - PageResponse() DiskEncryptionSetListResponse -} - -type diskEncryptionSetListCreateRequest func(context.Context) (*azcore.Request, error) - -type diskEncryptionSetListHandleError func(*azcore.Response) error - -type diskEncryptionSetListHandleResponse func(*azcore.Response) (DiskEncryptionSetListResponse, error) - -type diskEncryptionSetListAdvancePage func(context.Context, DiskEncryptionSetListResponse) (*azcore.Request, error) - -type diskEncryptionSetListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester diskEncryptionSetListCreateRequest - // callback for handling response errors - errorer diskEncryptionSetListHandleError - // callback for handling the HTTP response - responder diskEncryptionSetListHandleResponse - // callback for advancing to the next page - advancer diskEncryptionSetListAdvancePage - // contains the current response - current DiskEncryptionSetListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// CloudServiceOperatingSystemsListOSVersionsPager provides operations for iterating over paged responses. +type CloudServiceOperatingSystemsListOSVersionsPager struct { + client *CloudServiceOperatingSystemsClient + current CloudServiceOperatingSystemsListOSVersionsResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CloudServiceOperatingSystemsListOSVersionsResponse) (*policy.Request, error) } -func (p *diskEncryptionSetListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *CloudServiceOperatingSystemsListOSVersionsPager) Err() error { return p.err } -func (p *diskEncryptionSetListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CloudServiceOperatingSystemsListOSVersionsPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.DiskEncryptionSetList.NextLink == nil || len(*p.current.DiskEncryptionSetList.NextLink) == 0 { + if p.current.OSVersionListResult.NextLink == nil || len(*p.current.OSVersionListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -523,16 +372,16 @@ func (p *diskEncryptionSetListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listOSVersionsHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listOSVersionsHandleResponse(resp) if err != nil { p.err = err return false @@ -541,54 +390,32 @@ func (p *diskEncryptionSetListPager) NextPage(ctx context.Context) bool { return true } -func (p *diskEncryptionSetListPager) PageResponse() DiskEncryptionSetListResponse { +// PageResponse returns the current CloudServiceOperatingSystemsListOSVersionsResponse page. +func (p *CloudServiceOperatingSystemsListOSVersionsPager) PageResponse() CloudServiceOperatingSystemsListOSVersionsResponse { return p.current } -// DiskListPager provides iteration over DiskList pages. -type DiskListPager interface { - azcore.Pager - - // PageResponse returns the current DiskListResponse. - PageResponse() DiskListResponse -} - -type diskListCreateRequest func(context.Context) (*azcore.Request, error) - -type diskListHandleError func(*azcore.Response) error - -type diskListHandleResponse func(*azcore.Response) (DiskListResponse, error) - -type diskListAdvancePage func(context.Context, DiskListResponse) (*azcore.Request, error) - -type diskListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester diskListCreateRequest - // callback for handling response errors - errorer diskListHandleError - // callback for handling the HTTP response - responder diskListHandleResponse - // callback for advancing to the next page - advancer diskListAdvancePage - // contains the current response - current DiskListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// CloudServiceRoleInstancesListPager provides operations for iterating over paged responses. +type CloudServiceRoleInstancesListPager struct { + client *CloudServiceRoleInstancesClient + current CloudServiceRoleInstancesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CloudServiceRoleInstancesListResponse) (*policy.Request, error) } -func (p *diskListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *CloudServiceRoleInstancesListPager) Err() error { return p.err } -func (p *diskListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CloudServiceRoleInstancesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.DiskList.NextLink == nil || len(*p.current.DiskList.NextLink) == 0 { + if p.current.RoleInstanceListResult.NextLink == nil || len(*p.current.RoleInstanceListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -599,16 +426,16 @@ func (p *diskListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -617,54 +444,32 @@ func (p *diskListPager) NextPage(ctx context.Context) bool { return true } -func (p *diskListPager) PageResponse() DiskListResponse { +// PageResponse returns the current CloudServiceRoleInstancesListResponse page. +func (p *CloudServiceRoleInstancesListPager) PageResponse() CloudServiceRoleInstancesListResponse { return p.current } -// DiskRestorePointListPager provides iteration over DiskRestorePointList pages. -type DiskRestorePointListPager interface { - azcore.Pager - - // PageResponse returns the current DiskRestorePointListResponse. - PageResponse() DiskRestorePointListResponse -} - -type diskRestorePointListCreateRequest func(context.Context) (*azcore.Request, error) - -type diskRestorePointListHandleError func(*azcore.Response) error - -type diskRestorePointListHandleResponse func(*azcore.Response) (DiskRestorePointListResponse, error) - -type diskRestorePointListAdvancePage func(context.Context, DiskRestorePointListResponse) (*azcore.Request, error) - -type diskRestorePointListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester diskRestorePointListCreateRequest - // callback for handling response errors - errorer diskRestorePointListHandleError - // callback for handling the HTTP response - responder diskRestorePointListHandleResponse - // callback for advancing to the next page - advancer diskRestorePointListAdvancePage - // contains the current response - current DiskRestorePointListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// CloudServiceRolesListPager provides operations for iterating over paged responses. +type CloudServiceRolesListPager struct { + client *CloudServiceRolesClient + current CloudServiceRolesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CloudServiceRolesListResponse) (*policy.Request, error) } -func (p *diskRestorePointListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *CloudServiceRolesListPager) Err() error { return p.err } -func (p *diskRestorePointListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CloudServiceRolesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.DiskRestorePointList.NextLink == nil || len(*p.current.DiskRestorePointList.NextLink) == 0 { + if p.current.CloudServiceRoleListResult.NextLink == nil || len(*p.current.CloudServiceRoleListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -675,16 +480,16 @@ func (p *diskRestorePointListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -693,54 +498,32 @@ func (p *diskRestorePointListPager) NextPage(ctx context.Context) bool { return true } -func (p *diskRestorePointListPager) PageResponse() DiskRestorePointListResponse { +// PageResponse returns the current CloudServiceRolesListResponse page. +func (p *CloudServiceRolesListPager) PageResponse() CloudServiceRolesListResponse { return p.current } -// GalleryApplicationListPager provides iteration over GalleryApplicationList pages. -type GalleryApplicationListPager interface { - azcore.Pager - - // PageResponse returns the current GalleryApplicationListResponse. - PageResponse() GalleryApplicationListResponse -} - -type galleryApplicationListCreateRequest func(context.Context) (*azcore.Request, error) - -type galleryApplicationListHandleError func(*azcore.Response) error - -type galleryApplicationListHandleResponse func(*azcore.Response) (GalleryApplicationListResponse, error) - -type galleryApplicationListAdvancePage func(context.Context, GalleryApplicationListResponse) (*azcore.Request, error) - -type galleryApplicationListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester galleryApplicationListCreateRequest - // callback for handling response errors - errorer galleryApplicationListHandleError - // callback for handling the HTTP response - responder galleryApplicationListHandleResponse - // callback for advancing to the next page - advancer galleryApplicationListAdvancePage - // contains the current response - current GalleryApplicationListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// CloudServicesListAllPager provides operations for iterating over paged responses. +type CloudServicesListAllPager struct { + client *CloudServicesClient + current CloudServicesListAllResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CloudServicesListAllResponse) (*policy.Request, error) } -func (p *galleryApplicationListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *CloudServicesListAllPager) Err() error { return p.err } -func (p *galleryApplicationListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CloudServicesListAllPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.GalleryApplicationList.NextLink == nil || len(*p.current.GalleryApplicationList.NextLink) == 0 { + if p.current.CloudServiceListResult.NextLink == nil || len(*p.current.CloudServiceListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -751,16 +534,16 @@ func (p *galleryApplicationListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listAllHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listAllHandleResponse(resp) if err != nil { p.err = err return false @@ -769,54 +552,32 @@ func (p *galleryApplicationListPager) NextPage(ctx context.Context) bool { return true } -func (p *galleryApplicationListPager) PageResponse() GalleryApplicationListResponse { +// PageResponse returns the current CloudServicesListAllResponse page. +func (p *CloudServicesListAllPager) PageResponse() CloudServicesListAllResponse { return p.current } -// GalleryApplicationVersionListPager provides iteration over GalleryApplicationVersionList pages. -type GalleryApplicationVersionListPager interface { - azcore.Pager - - // PageResponse returns the current GalleryApplicationVersionListResponse. - PageResponse() GalleryApplicationVersionListResponse -} - -type galleryApplicationVersionListCreateRequest func(context.Context) (*azcore.Request, error) - -type galleryApplicationVersionListHandleError func(*azcore.Response) error - -type galleryApplicationVersionListHandleResponse func(*azcore.Response) (GalleryApplicationVersionListResponse, error) - -type galleryApplicationVersionListAdvancePage func(context.Context, GalleryApplicationVersionListResponse) (*azcore.Request, error) - -type galleryApplicationVersionListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester galleryApplicationVersionListCreateRequest - // callback for handling response errors - errorer galleryApplicationVersionListHandleError - // callback for handling the HTTP response - responder galleryApplicationVersionListHandleResponse - // callback for advancing to the next page - advancer galleryApplicationVersionListAdvancePage - // contains the current response - current GalleryApplicationVersionListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// CloudServicesListPager provides operations for iterating over paged responses. +type CloudServicesListPager struct { + client *CloudServicesClient + current CloudServicesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CloudServicesListResponse) (*policy.Request, error) } -func (p *galleryApplicationVersionListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *CloudServicesListPager) Err() error { return p.err } -func (p *galleryApplicationVersionListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CloudServicesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.GalleryApplicationVersionList.NextLink == nil || len(*p.current.GalleryApplicationVersionList.NextLink) == 0 { + if p.current.CloudServiceListResult.NextLink == nil || len(*p.current.CloudServiceListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -827,16 +588,16 @@ func (p *galleryApplicationVersionListPager) NextPage(ctx context.Context) bool p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -845,54 +606,32 @@ func (p *galleryApplicationVersionListPager) NextPage(ctx context.Context) bool return true } -func (p *galleryApplicationVersionListPager) PageResponse() GalleryApplicationVersionListResponse { +// PageResponse returns the current CloudServicesListResponse page. +func (p *CloudServicesListPager) PageResponse() CloudServicesListResponse { return p.current } -// GalleryImageListPager provides iteration over GalleryImageList pages. -type GalleryImageListPager interface { - azcore.Pager - - // PageResponse returns the current GalleryImageListResponse. - PageResponse() GalleryImageListResponse -} - -type galleryImageListCreateRequest func(context.Context) (*azcore.Request, error) - -type galleryImageListHandleError func(*azcore.Response) error - -type galleryImageListHandleResponse func(*azcore.Response) (GalleryImageListResponse, error) - -type galleryImageListAdvancePage func(context.Context, GalleryImageListResponse) (*azcore.Request, error) - -type galleryImageListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester galleryImageListCreateRequest - // callback for handling response errors - errorer galleryImageListHandleError - // callback for handling the HTTP response - responder galleryImageListHandleResponse - // callback for advancing to the next page - advancer galleryImageListAdvancePage - // contains the current response - current GalleryImageListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// CloudServicesUpdateDomainListUpdateDomainsPager provides operations for iterating over paged responses. +type CloudServicesUpdateDomainListUpdateDomainsPager struct { + client *CloudServicesUpdateDomainClient + current CloudServicesUpdateDomainListUpdateDomainsResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, CloudServicesUpdateDomainListUpdateDomainsResponse) (*policy.Request, error) } -func (p *galleryImageListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *CloudServicesUpdateDomainListUpdateDomainsPager) Err() error { return p.err } -func (p *galleryImageListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *CloudServicesUpdateDomainListUpdateDomainsPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.GalleryImageList.NextLink == nil || len(*p.current.GalleryImageList.NextLink) == 0 { + if p.current.UpdateDomainListResult.NextLink == nil || len(*p.current.UpdateDomainListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -903,16 +642,16 @@ func (p *galleryImageListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listUpdateDomainsHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listUpdateDomainsHandleResponse(resp) if err != nil { p.err = err return false @@ -921,54 +660,32 @@ func (p *galleryImageListPager) NextPage(ctx context.Context) bool { return true } -func (p *galleryImageListPager) PageResponse() GalleryImageListResponse { +// PageResponse returns the current CloudServicesUpdateDomainListUpdateDomainsResponse page. +func (p *CloudServicesUpdateDomainListUpdateDomainsPager) PageResponse() CloudServicesUpdateDomainListUpdateDomainsResponse { return p.current } -// GalleryImageVersionListPager provides iteration over GalleryImageVersionList pages. -type GalleryImageVersionListPager interface { - azcore.Pager - - // PageResponse returns the current GalleryImageVersionListResponse. - PageResponse() GalleryImageVersionListResponse -} - -type galleryImageVersionListCreateRequest func(context.Context) (*azcore.Request, error) - -type galleryImageVersionListHandleError func(*azcore.Response) error - -type galleryImageVersionListHandleResponse func(*azcore.Response) (GalleryImageVersionListResponse, error) - -type galleryImageVersionListAdvancePage func(context.Context, GalleryImageVersionListResponse) (*azcore.Request, error) - -type galleryImageVersionListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester galleryImageVersionListCreateRequest - // callback for handling response errors - errorer galleryImageVersionListHandleError - // callback for handling the HTTP response - responder galleryImageVersionListHandleResponse - // callback for advancing to the next page - advancer galleryImageVersionListAdvancePage - // contains the current response - current GalleryImageVersionListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DedicatedHostGroupsListByResourceGroupPager provides operations for iterating over paged responses. +type DedicatedHostGroupsListByResourceGroupPager struct { + client *DedicatedHostGroupsClient + current DedicatedHostGroupsListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DedicatedHostGroupsListByResourceGroupResponse) (*policy.Request, error) } -func (p *galleryImageVersionListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DedicatedHostGroupsListByResourceGroupPager) Err() error { return p.err } -func (p *galleryImageVersionListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DedicatedHostGroupsListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.GalleryImageVersionList.NextLink == nil || len(*p.current.GalleryImageVersionList.NextLink) == 0 { + if p.current.DedicatedHostGroupListResult.NextLink == nil || len(*p.current.DedicatedHostGroupListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -979,16 +696,16 @@ func (p *galleryImageVersionListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByResourceGroupHandleResponse(resp) if err != nil { p.err = err return false @@ -997,54 +714,32 @@ func (p *galleryImageVersionListPager) NextPage(ctx context.Context) bool { return true } -func (p *galleryImageVersionListPager) PageResponse() GalleryImageVersionListResponse { +// PageResponse returns the current DedicatedHostGroupsListByResourceGroupResponse page. +func (p *DedicatedHostGroupsListByResourceGroupPager) PageResponse() DedicatedHostGroupsListByResourceGroupResponse { return p.current } -// GalleryListPager provides iteration over GalleryList pages. -type GalleryListPager interface { - azcore.Pager - - // PageResponse returns the current GalleryListResponse. - PageResponse() GalleryListResponse -} - -type galleryListCreateRequest func(context.Context) (*azcore.Request, error) - -type galleryListHandleError func(*azcore.Response) error - -type galleryListHandleResponse func(*azcore.Response) (GalleryListResponse, error) - -type galleryListAdvancePage func(context.Context, GalleryListResponse) (*azcore.Request, error) - -type galleryListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester galleryListCreateRequest - // callback for handling response errors - errorer galleryListHandleError - // callback for handling the HTTP response - responder galleryListHandleResponse - // callback for advancing to the next page - advancer galleryListAdvancePage - // contains the current response - current GalleryListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DedicatedHostGroupsListBySubscriptionPager provides operations for iterating over paged responses. +type DedicatedHostGroupsListBySubscriptionPager struct { + client *DedicatedHostGroupsClient + current DedicatedHostGroupsListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DedicatedHostGroupsListBySubscriptionResponse) (*policy.Request, error) } -func (p *galleryListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DedicatedHostGroupsListBySubscriptionPager) Err() error { return p.err } -func (p *galleryListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DedicatedHostGroupsListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.GalleryList.NextLink == nil || len(*p.current.GalleryList.NextLink) == 0 { + if p.current.DedicatedHostGroupListResult.NextLink == nil || len(*p.current.DedicatedHostGroupListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1055,16 +750,16 @@ func (p *galleryListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listBySubscriptionHandleResponse(resp) if err != nil { p.err = err return false @@ -1073,54 +768,32 @@ func (p *galleryListPager) NextPage(ctx context.Context) bool { return true } -func (p *galleryListPager) PageResponse() GalleryListResponse { +// PageResponse returns the current DedicatedHostGroupsListBySubscriptionResponse page. +func (p *DedicatedHostGroupsListBySubscriptionPager) PageResponse() DedicatedHostGroupsListBySubscriptionResponse { return p.current } -// ImageListResultPager provides iteration over ImageListResult pages. -type ImageListResultPager interface { - azcore.Pager - - // PageResponse returns the current ImageListResultResponse. - PageResponse() ImageListResultResponse -} - -type imageListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type imageListResultHandleError func(*azcore.Response) error - -type imageListResultHandleResponse func(*azcore.Response) (ImageListResultResponse, error) - -type imageListResultAdvancePage func(context.Context, ImageListResultResponse) (*azcore.Request, error) - -type imageListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester imageListResultCreateRequest - // callback for handling response errors - errorer imageListResultHandleError - // callback for handling the HTTP response - responder imageListResultHandleResponse - // callback for advancing to the next page - advancer imageListResultAdvancePage - // contains the current response - current ImageListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DedicatedHostsListByHostGroupPager provides operations for iterating over paged responses. +type DedicatedHostsListByHostGroupPager struct { + client *DedicatedHostsClient + current DedicatedHostsListByHostGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DedicatedHostsListByHostGroupResponse) (*policy.Request, error) } -func (p *imageListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DedicatedHostsListByHostGroupPager) Err() error { return p.err } -func (p *imageListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DedicatedHostsListByHostGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.ImageListResult.NextLink == nil || len(*p.current.ImageListResult.NextLink) == 0 { + if p.current.DedicatedHostListResult.NextLink == nil || len(*p.current.DedicatedHostListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1131,16 +804,16 @@ func (p *imageListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByHostGroupHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByHostGroupHandleResponse(resp) if err != nil { p.err = err return false @@ -1149,54 +822,32 @@ func (p *imageListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *imageListResultPager) PageResponse() ImageListResultResponse { +// PageResponse returns the current DedicatedHostsListByHostGroupResponse page. +func (p *DedicatedHostsListByHostGroupPager) PageResponse() DedicatedHostsListByHostGroupResponse { return p.current } -// ListUsagesResultPager provides iteration over ListUsagesResult pages. -type ListUsagesResultPager interface { - azcore.Pager - - // PageResponse returns the current ListUsagesResultResponse. - PageResponse() ListUsagesResultResponse -} - -type listUsagesResultCreateRequest func(context.Context) (*azcore.Request, error) - -type listUsagesResultHandleError func(*azcore.Response) error - -type listUsagesResultHandleResponse func(*azcore.Response) (ListUsagesResultResponse, error) - -type listUsagesResultAdvancePage func(context.Context, ListUsagesResultResponse) (*azcore.Request, error) - -type listUsagesResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester listUsagesResultCreateRequest - // callback for handling response errors - errorer listUsagesResultHandleError - // callback for handling the HTTP response - responder listUsagesResultHandleResponse - // callback for advancing to the next page - advancer listUsagesResultAdvancePage - // contains the current response - current ListUsagesResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DiskAccessesListByResourceGroupPager provides operations for iterating over paged responses. +type DiskAccessesListByResourceGroupPager struct { + client *DiskAccessesClient + current DiskAccessesListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DiskAccessesListByResourceGroupResponse) (*policy.Request, error) } -func (p *listUsagesResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DiskAccessesListByResourceGroupPager) Err() error { return p.err } -func (p *listUsagesResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DiskAccessesListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.ListUsagesResult.NextLink == nil || len(*p.current.ListUsagesResult.NextLink) == 0 { + if p.current.DiskAccessList.NextLink == nil || len(*p.current.DiskAccessList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1207,16 +858,16 @@ func (p *listUsagesResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByResourceGroupHandleResponse(resp) if err != nil { p.err = err return false @@ -1225,54 +876,32 @@ func (p *listUsagesResultPager) NextPage(ctx context.Context) bool { return true } -func (p *listUsagesResultPager) PageResponse() ListUsagesResultResponse { +// PageResponse returns the current DiskAccessesListByResourceGroupResponse page. +func (p *DiskAccessesListByResourceGroupPager) PageResponse() DiskAccessesListByResourceGroupResponse { return p.current } -// OSFamilyListResultPager provides iteration over OSFamilyListResult pages. -type OSFamilyListResultPager interface { - azcore.Pager - - // PageResponse returns the current OSFamilyListResultResponse. - PageResponse() OSFamilyListResultResponse -} - -type osFamilyListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type osFamilyListResultHandleError func(*azcore.Response) error - -type osFamilyListResultHandleResponse func(*azcore.Response) (OSFamilyListResultResponse, error) - -type osFamilyListResultAdvancePage func(context.Context, OSFamilyListResultResponse) (*azcore.Request, error) - -type osFamilyListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester osFamilyListResultCreateRequest - // callback for handling response errors - errorer osFamilyListResultHandleError - // callback for handling the HTTP response - responder osFamilyListResultHandleResponse - // callback for advancing to the next page - advancer osFamilyListResultAdvancePage - // contains the current response - current OSFamilyListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DiskAccessesListPager provides operations for iterating over paged responses. +type DiskAccessesListPager struct { + client *DiskAccessesClient + current DiskAccessesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DiskAccessesListResponse) (*policy.Request, error) } -func (p *osFamilyListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DiskAccessesListPager) Err() error { return p.err } -func (p *osFamilyListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DiskAccessesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.OSFamilyListResult.NextLink == nil || len(*p.current.OSFamilyListResult.NextLink) == 0 { + if p.current.DiskAccessList.NextLink == nil || len(*p.current.DiskAccessList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1283,16 +912,16 @@ func (p *osFamilyListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -1301,54 +930,32 @@ func (p *osFamilyListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *osFamilyListResultPager) PageResponse() OSFamilyListResultResponse { +// PageResponse returns the current DiskAccessesListResponse page. +func (p *DiskAccessesListPager) PageResponse() DiskAccessesListResponse { return p.current } -// OSVersionListResultPager provides iteration over OSVersionListResult pages. -type OSVersionListResultPager interface { - azcore.Pager - - // PageResponse returns the current OSVersionListResultResponse. - PageResponse() OSVersionListResultResponse -} - -type osVersionListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type osVersionListResultHandleError func(*azcore.Response) error - -type osVersionListResultHandleResponse func(*azcore.Response) (OSVersionListResultResponse, error) - -type osVersionListResultAdvancePage func(context.Context, OSVersionListResultResponse) (*azcore.Request, error) - -type osVersionListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester osVersionListResultCreateRequest - // callback for handling response errors - errorer osVersionListResultHandleError - // callback for handling the HTTP response - responder osVersionListResultHandleResponse - // callback for advancing to the next page - advancer osVersionListResultAdvancePage - // contains the current response - current OSVersionListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DiskAccessesListPrivateEndpointConnectionsPager provides operations for iterating over paged responses. +type DiskAccessesListPrivateEndpointConnectionsPager struct { + client *DiskAccessesClient + current DiskAccessesListPrivateEndpointConnectionsResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DiskAccessesListPrivateEndpointConnectionsResponse) (*policy.Request, error) } -func (p *osVersionListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DiskAccessesListPrivateEndpointConnectionsPager) Err() error { return p.err } -func (p *osVersionListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DiskAccessesListPrivateEndpointConnectionsPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.OSVersionListResult.NextLink == nil || len(*p.current.OSVersionListResult.NextLink) == 0 { + if p.current.PrivateEndpointConnectionListResult.NextLink == nil || len(*p.current.PrivateEndpointConnectionListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1359,16 +966,16 @@ func (p *osVersionListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listPrivateEndpointConnectionsHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listPrivateEndpointConnectionsHandleResponse(resp) if err != nil { p.err = err return false @@ -1377,54 +984,32 @@ func (p *osVersionListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *osVersionListResultPager) PageResponse() OSVersionListResultResponse { +// PageResponse returns the current DiskAccessesListPrivateEndpointConnectionsResponse page. +func (p *DiskAccessesListPrivateEndpointConnectionsPager) PageResponse() DiskAccessesListPrivateEndpointConnectionsResponse { return p.current } -// PrivateEndpointConnectionListResultPager provides iteration over PrivateEndpointConnectionListResult pages. -type PrivateEndpointConnectionListResultPager interface { - azcore.Pager - - // PageResponse returns the current PrivateEndpointConnectionListResultResponse. - PageResponse() PrivateEndpointConnectionListResultResponse -} - -type privateEndpointConnectionListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type privateEndpointConnectionListResultHandleError func(*azcore.Response) error - -type privateEndpointConnectionListResultHandleResponse func(*azcore.Response) (PrivateEndpointConnectionListResultResponse, error) - -type privateEndpointConnectionListResultAdvancePage func(context.Context, PrivateEndpointConnectionListResultResponse) (*azcore.Request, error) - -type privateEndpointConnectionListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester privateEndpointConnectionListResultCreateRequest - // callback for handling response errors - errorer privateEndpointConnectionListResultHandleError - // callback for handling the HTTP response - responder privateEndpointConnectionListResultHandleResponse - // callback for advancing to the next page - advancer privateEndpointConnectionListResultAdvancePage - // contains the current response - current PrivateEndpointConnectionListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DiskEncryptionSetsListAssociatedResourcesPager provides operations for iterating over paged responses. +type DiskEncryptionSetsListAssociatedResourcesPager struct { + client *DiskEncryptionSetsClient + current DiskEncryptionSetsListAssociatedResourcesResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DiskEncryptionSetsListAssociatedResourcesResponse) (*policy.Request, error) } -func (p *privateEndpointConnectionListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DiskEncryptionSetsListAssociatedResourcesPager) Err() error { return p.err } -func (p *privateEndpointConnectionListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DiskEncryptionSetsListAssociatedResourcesPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.PrivateEndpointConnectionListResult.NextLink == nil || len(*p.current.PrivateEndpointConnectionListResult.NextLink) == 0 { + if p.current.ResourceURIList.NextLink == nil || len(*p.current.ResourceURIList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1435,16 +1020,16 @@ func (p *privateEndpointConnectionListResultPager) NextPage(ctx context.Context) p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listAssociatedResourcesHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listAssociatedResourcesHandleResponse(resp) if err != nil { p.err = err return false @@ -1453,54 +1038,32 @@ func (p *privateEndpointConnectionListResultPager) NextPage(ctx context.Context) return true } -func (p *privateEndpointConnectionListResultPager) PageResponse() PrivateEndpointConnectionListResultResponse { +// PageResponse returns the current DiskEncryptionSetsListAssociatedResourcesResponse page. +func (p *DiskEncryptionSetsListAssociatedResourcesPager) PageResponse() DiskEncryptionSetsListAssociatedResourcesResponse { return p.current } -// ProximityPlacementGroupListResultPager provides iteration over ProximityPlacementGroupListResult pages. -type ProximityPlacementGroupListResultPager interface { - azcore.Pager - - // PageResponse returns the current ProximityPlacementGroupListResultResponse. - PageResponse() ProximityPlacementGroupListResultResponse -} - -type proximityPlacementGroupListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type proximityPlacementGroupListResultHandleError func(*azcore.Response) error - -type proximityPlacementGroupListResultHandleResponse func(*azcore.Response) (ProximityPlacementGroupListResultResponse, error) - -type proximityPlacementGroupListResultAdvancePage func(context.Context, ProximityPlacementGroupListResultResponse) (*azcore.Request, error) - -type proximityPlacementGroupListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester proximityPlacementGroupListResultCreateRequest - // callback for handling response errors - errorer proximityPlacementGroupListResultHandleError - // callback for handling the HTTP response - responder proximityPlacementGroupListResultHandleResponse - // callback for advancing to the next page - advancer proximityPlacementGroupListResultAdvancePage - // contains the current response - current ProximityPlacementGroupListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DiskEncryptionSetsListByResourceGroupPager provides operations for iterating over paged responses. +type DiskEncryptionSetsListByResourceGroupPager struct { + client *DiskEncryptionSetsClient + current DiskEncryptionSetsListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DiskEncryptionSetsListByResourceGroupResponse) (*policy.Request, error) } -func (p *proximityPlacementGroupListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DiskEncryptionSetsListByResourceGroupPager) Err() error { return p.err } -func (p *proximityPlacementGroupListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DiskEncryptionSetsListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.ProximityPlacementGroupListResult.NextLink == nil || len(*p.current.ProximityPlacementGroupListResult.NextLink) == 0 { + if p.current.DiskEncryptionSetList.NextLink == nil || len(*p.current.DiskEncryptionSetList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1511,16 +1074,16 @@ func (p *proximityPlacementGroupListResultPager) NextPage(ctx context.Context) b p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByResourceGroupHandleResponse(resp) if err != nil { p.err = err return false @@ -1529,54 +1092,32 @@ func (p *proximityPlacementGroupListResultPager) NextPage(ctx context.Context) b return true } -func (p *proximityPlacementGroupListResultPager) PageResponse() ProximityPlacementGroupListResultResponse { +// PageResponse returns the current DiskEncryptionSetsListByResourceGroupResponse page. +func (p *DiskEncryptionSetsListByResourceGroupPager) PageResponse() DiskEncryptionSetsListByResourceGroupResponse { return p.current } -// ResourceSKUsResultPager provides iteration over ResourceSKUsResult pages. -type ResourceSKUsResultPager interface { - azcore.Pager - - // PageResponse returns the current ResourceSKUsResultResponse. - PageResponse() ResourceSKUsResultResponse -} - -type resourceSKUsResultCreateRequest func(context.Context) (*azcore.Request, error) - -type resourceSKUsResultHandleError func(*azcore.Response) error - -type resourceSKUsResultHandleResponse func(*azcore.Response) (ResourceSKUsResultResponse, error) - -type resourceSKUsResultAdvancePage func(context.Context, ResourceSKUsResultResponse) (*azcore.Request, error) - -type resourceSKUsResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester resourceSKUsResultCreateRequest - // callback for handling response errors - errorer resourceSKUsResultHandleError - // callback for handling the HTTP response - responder resourceSKUsResultHandleResponse - // callback for advancing to the next page - advancer resourceSKUsResultAdvancePage - // contains the current response - current ResourceSKUsResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DiskEncryptionSetsListPager provides operations for iterating over paged responses. +type DiskEncryptionSetsListPager struct { + client *DiskEncryptionSetsClient + current DiskEncryptionSetsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DiskEncryptionSetsListResponse) (*policy.Request, error) } -func (p *resourceSKUsResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DiskEncryptionSetsListPager) Err() error { return p.err } -func (p *resourceSKUsResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DiskEncryptionSetsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.ResourceSKUsResult.NextLink == nil || len(*p.current.ResourceSKUsResult.NextLink) == 0 { + if p.current.DiskEncryptionSetList.NextLink == nil || len(*p.current.DiskEncryptionSetList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1587,16 +1128,16 @@ func (p *resourceSKUsResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -1605,54 +1146,32 @@ func (p *resourceSKUsResultPager) NextPage(ctx context.Context) bool { return true } -func (p *resourceSKUsResultPager) PageResponse() ResourceSKUsResultResponse { +// PageResponse returns the current DiskEncryptionSetsListResponse page. +func (p *DiskEncryptionSetsListPager) PageResponse() DiskEncryptionSetsListResponse { return p.current } -// ResourceURIListPager provides iteration over ResourceURIList pages. -type ResourceURIListPager interface { - azcore.Pager - - // PageResponse returns the current ResourceURIListResponse. - PageResponse() ResourceURIListResponse -} - -type resourceURIListCreateRequest func(context.Context) (*azcore.Request, error) - -type resourceURIListHandleError func(*azcore.Response) error - -type resourceURIListHandleResponse func(*azcore.Response) (ResourceURIListResponse, error) - -type resourceURIListAdvancePage func(context.Context, ResourceURIListResponse) (*azcore.Request, error) - -type resourceURIListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester resourceURIListCreateRequest - // callback for handling response errors - errorer resourceURIListHandleError - // callback for handling the HTTP response - responder resourceURIListHandleResponse - // callback for advancing to the next page - advancer resourceURIListAdvancePage - // contains the current response - current ResourceURIListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DiskRestorePointListByRestorePointPager provides operations for iterating over paged responses. +type DiskRestorePointListByRestorePointPager struct { + client *DiskRestorePointClient + current DiskRestorePointListByRestorePointResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DiskRestorePointListByRestorePointResponse) (*policy.Request, error) } -func (p *resourceURIListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DiskRestorePointListByRestorePointPager) Err() error { return p.err } -func (p *resourceURIListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DiskRestorePointListByRestorePointPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.ResourceURIList.NextLink == nil || len(*p.current.ResourceURIList.NextLink) == 0 { + if p.current.DiskRestorePointList.NextLink == nil || len(*p.current.DiskRestorePointList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1663,16 +1182,16 @@ func (p *resourceURIListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByRestorePointHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByRestorePointHandleResponse(resp) if err != nil { p.err = err return false @@ -1681,54 +1200,32 @@ func (p *resourceURIListPager) NextPage(ctx context.Context) bool { return true } -func (p *resourceURIListPager) PageResponse() ResourceURIListResponse { +// PageResponse returns the current DiskRestorePointListByRestorePointResponse page. +func (p *DiskRestorePointListByRestorePointPager) PageResponse() DiskRestorePointListByRestorePointResponse { return p.current } -// RestorePointCollectionListResultPager provides iteration over RestorePointCollectionListResult pages. -type RestorePointCollectionListResultPager interface { - azcore.Pager - - // PageResponse returns the current RestorePointCollectionListResultResponse. - PageResponse() RestorePointCollectionListResultResponse -} - -type restorePointCollectionListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type restorePointCollectionListResultHandleError func(*azcore.Response) error - -type restorePointCollectionListResultHandleResponse func(*azcore.Response) (RestorePointCollectionListResultResponse, error) - -type restorePointCollectionListResultAdvancePage func(context.Context, RestorePointCollectionListResultResponse) (*azcore.Request, error) - -type restorePointCollectionListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester restorePointCollectionListResultCreateRequest - // callback for handling response errors - errorer restorePointCollectionListResultHandleError - // callback for handling the HTTP response - responder restorePointCollectionListResultHandleResponse - // callback for advancing to the next page - advancer restorePointCollectionListResultAdvancePage - // contains the current response - current RestorePointCollectionListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DisksListByResourceGroupPager provides operations for iterating over paged responses. +type DisksListByResourceGroupPager struct { + client *DisksClient + current DisksListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DisksListByResourceGroupResponse) (*policy.Request, error) } -func (p *restorePointCollectionListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DisksListByResourceGroupPager) Err() error { return p.err } -func (p *restorePointCollectionListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DisksListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.RestorePointCollectionListResult.NextLink == nil || len(*p.current.RestorePointCollectionListResult.NextLink) == 0 { + if p.current.DiskList.NextLink == nil || len(*p.current.DiskList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1739,16 +1236,16 @@ func (p *restorePointCollectionListResultPager) NextPage(ctx context.Context) bo p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByResourceGroupHandleResponse(resp) if err != nil { p.err = err return false @@ -1757,54 +1254,32 @@ func (p *restorePointCollectionListResultPager) NextPage(ctx context.Context) bo return true } -func (p *restorePointCollectionListResultPager) PageResponse() RestorePointCollectionListResultResponse { +// PageResponse returns the current DisksListByResourceGroupResponse page. +func (p *DisksListByResourceGroupPager) PageResponse() DisksListByResourceGroupResponse { return p.current } -// RoleInstanceListResultPager provides iteration over RoleInstanceListResult pages. -type RoleInstanceListResultPager interface { - azcore.Pager - - // PageResponse returns the current RoleInstanceListResultResponse. - PageResponse() RoleInstanceListResultResponse -} - -type roleInstanceListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type roleInstanceListResultHandleError func(*azcore.Response) error - -type roleInstanceListResultHandleResponse func(*azcore.Response) (RoleInstanceListResultResponse, error) - -type roleInstanceListResultAdvancePage func(context.Context, RoleInstanceListResultResponse) (*azcore.Request, error) - -type roleInstanceListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester roleInstanceListResultCreateRequest - // callback for handling response errors - errorer roleInstanceListResultHandleError - // callback for handling the HTTP response - responder roleInstanceListResultHandleResponse - // callback for advancing to the next page - advancer roleInstanceListResultAdvancePage - // contains the current response - current RoleInstanceListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// DisksListPager provides operations for iterating over paged responses. +type DisksListPager struct { + client *DisksClient + current DisksListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, DisksListResponse) (*policy.Request, error) } -func (p *roleInstanceListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *DisksListPager) Err() error { return p.err } -func (p *roleInstanceListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *DisksListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.RoleInstanceListResult.NextLink == nil || len(*p.current.RoleInstanceListResult.NextLink) == 0 { + if p.current.DiskList.NextLink == nil || len(*p.current.DiskList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1815,16 +1290,16 @@ func (p *roleInstanceListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -1833,54 +1308,32 @@ func (p *roleInstanceListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *roleInstanceListResultPager) PageResponse() RoleInstanceListResultResponse { +// PageResponse returns the current DisksListResponse page. +func (p *DisksListPager) PageResponse() DisksListResponse { return p.current } -// RunCommandListResultPager provides iteration over RunCommandListResult pages. -type RunCommandListResultPager interface { - azcore.Pager - - // PageResponse returns the current RunCommandListResultResponse. - PageResponse() RunCommandListResultResponse -} - -type runCommandListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type runCommandListResultHandleError func(*azcore.Response) error - -type runCommandListResultHandleResponse func(*azcore.Response) (RunCommandListResultResponse, error) - -type runCommandListResultAdvancePage func(context.Context, RunCommandListResultResponse) (*azcore.Request, error) - -type runCommandListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester runCommandListResultCreateRequest - // callback for handling response errors - errorer runCommandListResultHandleError - // callback for handling the HTTP response - responder runCommandListResultHandleResponse - // callback for advancing to the next page - advancer runCommandListResultAdvancePage - // contains the current response - current RunCommandListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// GalleriesListByResourceGroupPager provides operations for iterating over paged responses. +type GalleriesListByResourceGroupPager struct { + client *GalleriesClient + current GalleriesListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, GalleriesListByResourceGroupResponse) (*policy.Request, error) } -func (p *runCommandListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *GalleriesListByResourceGroupPager) Err() error { return p.err } -func (p *runCommandListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *GalleriesListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.RunCommandListResult.NextLink == nil || len(*p.current.RunCommandListResult.NextLink) == 0 { + if p.current.GalleryList.NextLink == nil || len(*p.current.GalleryList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1891,16 +1344,16 @@ func (p *runCommandListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByResourceGroupHandleResponse(resp) if err != nil { p.err = err return false @@ -1909,54 +1362,32 @@ func (p *runCommandListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *runCommandListResultPager) PageResponse() RunCommandListResultResponse { +// PageResponse returns the current GalleriesListByResourceGroupResponse page. +func (p *GalleriesListByResourceGroupPager) PageResponse() GalleriesListByResourceGroupResponse { return p.current } -// SSHPublicKeysGroupListResultPager provides iteration over SSHPublicKeysGroupListResult pages. -type SSHPublicKeysGroupListResultPager interface { - azcore.Pager - - // PageResponse returns the current SSHPublicKeysGroupListResultResponse. - PageResponse() SSHPublicKeysGroupListResultResponse -} - -type sshPublicKeysGroupListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type sshPublicKeysGroupListResultHandleError func(*azcore.Response) error - -type sshPublicKeysGroupListResultHandleResponse func(*azcore.Response) (SSHPublicKeysGroupListResultResponse, error) - -type sshPublicKeysGroupListResultAdvancePage func(context.Context, SSHPublicKeysGroupListResultResponse) (*azcore.Request, error) - -type sshPublicKeysGroupListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester sshPublicKeysGroupListResultCreateRequest - // callback for handling response errors - errorer sshPublicKeysGroupListResultHandleError - // callback for handling the HTTP response - responder sshPublicKeysGroupListResultHandleResponse - // callback for advancing to the next page - advancer sshPublicKeysGroupListResultAdvancePage - // contains the current response - current SSHPublicKeysGroupListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// GalleriesListPager provides operations for iterating over paged responses. +type GalleriesListPager struct { + client *GalleriesClient + current GalleriesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, GalleriesListResponse) (*policy.Request, error) } -func (p *sshPublicKeysGroupListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *GalleriesListPager) Err() error { return p.err } -func (p *sshPublicKeysGroupListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *GalleriesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.SSHPublicKeysGroupListResult.NextLink == nil || len(*p.current.SSHPublicKeysGroupListResult.NextLink) == 0 { + if p.current.GalleryList.NextLink == nil || len(*p.current.GalleryList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -1967,16 +1398,16 @@ func (p *sshPublicKeysGroupListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -1985,54 +1416,32 @@ func (p *sshPublicKeysGroupListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *sshPublicKeysGroupListResultPager) PageResponse() SSHPublicKeysGroupListResultResponse { +// PageResponse returns the current GalleriesListResponse page. +func (p *GalleriesListPager) PageResponse() GalleriesListResponse { return p.current } -// SharedGalleryImageListPager provides iteration over SharedGalleryImageList pages. -type SharedGalleryImageListPager interface { - azcore.Pager - - // PageResponse returns the current SharedGalleryImageListResponse. - PageResponse() SharedGalleryImageListResponse -} - -type sharedGalleryImageListCreateRequest func(context.Context) (*azcore.Request, error) - -type sharedGalleryImageListHandleError func(*azcore.Response) error - -type sharedGalleryImageListHandleResponse func(*azcore.Response) (SharedGalleryImageListResponse, error) - -type sharedGalleryImageListAdvancePage func(context.Context, SharedGalleryImageListResponse) (*azcore.Request, error) - -type sharedGalleryImageListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester sharedGalleryImageListCreateRequest - // callback for handling response errors - errorer sharedGalleryImageListHandleError - // callback for handling the HTTP response - responder sharedGalleryImageListHandleResponse - // callback for advancing to the next page - advancer sharedGalleryImageListAdvancePage - // contains the current response - current SharedGalleryImageListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// GalleryApplicationVersionsListByGalleryApplicationPager provides operations for iterating over paged responses. +type GalleryApplicationVersionsListByGalleryApplicationPager struct { + client *GalleryApplicationVersionsClient + current GalleryApplicationVersionsListByGalleryApplicationResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, GalleryApplicationVersionsListByGalleryApplicationResponse) (*policy.Request, error) } -func (p *sharedGalleryImageListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *GalleryApplicationVersionsListByGalleryApplicationPager) Err() error { return p.err } -func (p *sharedGalleryImageListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *GalleryApplicationVersionsListByGalleryApplicationPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.SharedGalleryImageList.NextLink == nil || len(*p.current.SharedGalleryImageList.NextLink) == 0 { + if p.current.GalleryApplicationVersionList.NextLink == nil || len(*p.current.GalleryApplicationVersionList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -2043,16 +1452,16 @@ func (p *sharedGalleryImageListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByGalleryApplicationHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByGalleryApplicationHandleResponse(resp) if err != nil { p.err = err return false @@ -2061,54 +1470,32 @@ func (p *sharedGalleryImageListPager) NextPage(ctx context.Context) bool { return true } -func (p *sharedGalleryImageListPager) PageResponse() SharedGalleryImageListResponse { +// PageResponse returns the current GalleryApplicationVersionsListByGalleryApplicationResponse page. +func (p *GalleryApplicationVersionsListByGalleryApplicationPager) PageResponse() GalleryApplicationVersionsListByGalleryApplicationResponse { return p.current } -// SharedGalleryImageVersionListPager provides iteration over SharedGalleryImageVersionList pages. -type SharedGalleryImageVersionListPager interface { - azcore.Pager - - // PageResponse returns the current SharedGalleryImageVersionListResponse. - PageResponse() SharedGalleryImageVersionListResponse -} - -type sharedGalleryImageVersionListCreateRequest func(context.Context) (*azcore.Request, error) - -type sharedGalleryImageVersionListHandleError func(*azcore.Response) error - -type sharedGalleryImageVersionListHandleResponse func(*azcore.Response) (SharedGalleryImageVersionListResponse, error) - -type sharedGalleryImageVersionListAdvancePage func(context.Context, SharedGalleryImageVersionListResponse) (*azcore.Request, error) - -type sharedGalleryImageVersionListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester sharedGalleryImageVersionListCreateRequest - // callback for handling response errors - errorer sharedGalleryImageVersionListHandleError - // callback for handling the HTTP response - responder sharedGalleryImageVersionListHandleResponse - // callback for advancing to the next page - advancer sharedGalleryImageVersionListAdvancePage - // contains the current response - current SharedGalleryImageVersionListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// GalleryApplicationsListByGalleryPager provides operations for iterating over paged responses. +type GalleryApplicationsListByGalleryPager struct { + client *GalleryApplicationsClient + current GalleryApplicationsListByGalleryResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, GalleryApplicationsListByGalleryResponse) (*policy.Request, error) } -func (p *sharedGalleryImageVersionListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *GalleryApplicationsListByGalleryPager) Err() error { return p.err } -func (p *sharedGalleryImageVersionListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *GalleryApplicationsListByGalleryPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.SharedGalleryImageVersionList.NextLink == nil || len(*p.current.SharedGalleryImageVersionList.NextLink) == 0 { + if p.current.GalleryApplicationList.NextLink == nil || len(*p.current.GalleryApplicationList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -2119,16 +1506,16 @@ func (p *sharedGalleryImageVersionListPager) NextPage(ctx context.Context) bool p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByGalleryHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByGalleryHandleResponse(resp) if err != nil { p.err = err return false @@ -2137,54 +1524,680 @@ func (p *sharedGalleryImageVersionListPager) NextPage(ctx context.Context) bool return true } -func (p *sharedGalleryImageVersionListPager) PageResponse() SharedGalleryImageVersionListResponse { +// PageResponse returns the current GalleryApplicationsListByGalleryResponse page. +func (p *GalleryApplicationsListByGalleryPager) PageResponse() GalleryApplicationsListByGalleryResponse { return p.current } -// SharedGalleryListPager provides iteration over SharedGalleryList pages. -type SharedGalleryListPager interface { - azcore.Pager - - // PageResponse returns the current SharedGalleryListResponse. - PageResponse() SharedGalleryListResponse -} - -type sharedGalleryListCreateRequest func(context.Context) (*azcore.Request, error) - -type sharedGalleryListHandleError func(*azcore.Response) error - -type sharedGalleryListHandleResponse func(*azcore.Response) (SharedGalleryListResponse, error) - -type sharedGalleryListAdvancePage func(context.Context, SharedGalleryListResponse) (*azcore.Request, error) - -type sharedGalleryListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester sharedGalleryListCreateRequest - // callback for handling response errors - errorer sharedGalleryListHandleError - // callback for handling the HTTP response - responder sharedGalleryListHandleResponse - // callback for advancing to the next page - advancer sharedGalleryListAdvancePage - // contains the current response - current SharedGalleryListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// GalleryImageVersionsListByGalleryImagePager provides operations for iterating over paged responses. +type GalleryImageVersionsListByGalleryImagePager struct { + client *GalleryImageVersionsClient + current GalleryImageVersionsListByGalleryImageResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, GalleryImageVersionsListByGalleryImageResponse) (*policy.Request, error) } -func (p *sharedGalleryListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *GalleryImageVersionsListByGalleryImagePager) Err() error { return p.err } -func (p *sharedGalleryListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *GalleryImageVersionsListByGalleryImagePager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.SharedGalleryList.NextLink == nil || len(*p.current.SharedGalleryList.NextLink) == 0 { + if p.current.GalleryImageVersionList.NextLink == nil || len(*p.current.GalleryImageVersionList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByGalleryImageHandleError(resp) + return false + } + result, err := p.client.listByGalleryImageHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current GalleryImageVersionsListByGalleryImageResponse page. +func (p *GalleryImageVersionsListByGalleryImagePager) PageResponse() GalleryImageVersionsListByGalleryImageResponse { + return p.current +} + +// GalleryImagesListByGalleryPager provides operations for iterating over paged responses. +type GalleryImagesListByGalleryPager struct { + client *GalleryImagesClient + current GalleryImagesListByGalleryResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, GalleryImagesListByGalleryResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *GalleryImagesListByGalleryPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *GalleryImagesListByGalleryPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.GalleryImageList.NextLink == nil || len(*p.current.GalleryImageList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByGalleryHandleError(resp) + return false + } + result, err := p.client.listByGalleryHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current GalleryImagesListByGalleryResponse page. +func (p *GalleryImagesListByGalleryPager) PageResponse() GalleryImagesListByGalleryResponse { + return p.current +} + +// ImagesListByResourceGroupPager provides operations for iterating over paged responses. +type ImagesListByResourceGroupPager struct { + client *ImagesClient + current ImagesListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ImagesListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ImagesListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ImagesListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ImageListResult.NextLink == nil || len(*p.current.ImageListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ImagesListByResourceGroupResponse page. +func (p *ImagesListByResourceGroupPager) PageResponse() ImagesListByResourceGroupResponse { + return p.current +} + +// ImagesListPager provides operations for iterating over paged responses. +type ImagesListPager struct { + client *ImagesClient + current ImagesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ImagesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ImagesListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ImagesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ImageListResult.NextLink == nil || len(*p.current.ImageListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ImagesListResponse page. +func (p *ImagesListPager) PageResponse() ImagesListResponse { + return p.current +} + +// ProximityPlacementGroupsListByResourceGroupPager provides operations for iterating over paged responses. +type ProximityPlacementGroupsListByResourceGroupPager struct { + client *ProximityPlacementGroupsClient + current ProximityPlacementGroupsListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ProximityPlacementGroupsListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ProximityPlacementGroupsListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ProximityPlacementGroupsListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ProximityPlacementGroupListResult.NextLink == nil || len(*p.current.ProximityPlacementGroupListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ProximityPlacementGroupsListByResourceGroupResponse page. +func (p *ProximityPlacementGroupsListByResourceGroupPager) PageResponse() ProximityPlacementGroupsListByResourceGroupResponse { + return p.current +} + +// ProximityPlacementGroupsListBySubscriptionPager provides operations for iterating over paged responses. +type ProximityPlacementGroupsListBySubscriptionPager struct { + client *ProximityPlacementGroupsClient + current ProximityPlacementGroupsListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ProximityPlacementGroupsListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ProximityPlacementGroupsListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ProximityPlacementGroupsListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ProximityPlacementGroupListResult.NextLink == nil || len(*p.current.ProximityPlacementGroupListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ProximityPlacementGroupsListBySubscriptionResponse page. +func (p *ProximityPlacementGroupsListBySubscriptionPager) PageResponse() ProximityPlacementGroupsListBySubscriptionResponse { + return p.current +} + +// ResourceSKUsListPager provides operations for iterating over paged responses. +type ResourceSKUsListPager struct { + client *ResourceSKUsClient + current ResourceSKUsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, ResourceSKUsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *ResourceSKUsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *ResourceSKUsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ResourceSKUsResult.NextLink == nil || len(*p.current.ResourceSKUsResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current ResourceSKUsListResponse page. +func (p *ResourceSKUsListPager) PageResponse() ResourceSKUsListResponse { + return p.current +} + +// RestorePointCollectionsListAllPager provides operations for iterating over paged responses. +type RestorePointCollectionsListAllPager struct { + client *RestorePointCollectionsClient + current RestorePointCollectionsListAllResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, RestorePointCollectionsListAllResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *RestorePointCollectionsListAllPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *RestorePointCollectionsListAllPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.RestorePointCollectionListResult.NextLink == nil || len(*p.current.RestorePointCollectionListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listAllHandleError(resp) + return false + } + result, err := p.client.listAllHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current RestorePointCollectionsListAllResponse page. +func (p *RestorePointCollectionsListAllPager) PageResponse() RestorePointCollectionsListAllResponse { + return p.current +} + +// RestorePointCollectionsListPager provides operations for iterating over paged responses. +type RestorePointCollectionsListPager struct { + client *RestorePointCollectionsClient + current RestorePointCollectionsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, RestorePointCollectionsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *RestorePointCollectionsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *RestorePointCollectionsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.RestorePointCollectionListResult.NextLink == nil || len(*p.current.RestorePointCollectionListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current RestorePointCollectionsListResponse page. +func (p *RestorePointCollectionsListPager) PageResponse() RestorePointCollectionsListResponse { + return p.current +} + +// SSHPublicKeysListByResourceGroupPager provides operations for iterating over paged responses. +type SSHPublicKeysListByResourceGroupPager struct { + client *SSHPublicKeysClient + current SSHPublicKeysListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SSHPublicKeysListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SSHPublicKeysListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SSHPublicKeysListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SSHPublicKeysGroupListResult.NextLink == nil || len(*p.current.SSHPublicKeysGroupListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current SSHPublicKeysListByResourceGroupResponse page. +func (p *SSHPublicKeysListByResourceGroupPager) PageResponse() SSHPublicKeysListByResourceGroupResponse { + return p.current +} + +// SSHPublicKeysListBySubscriptionPager provides operations for iterating over paged responses. +type SSHPublicKeysListBySubscriptionPager struct { + client *SSHPublicKeysClient + current SSHPublicKeysListBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SSHPublicKeysListBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SSHPublicKeysListBySubscriptionPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SSHPublicKeysListBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SSHPublicKeysGroupListResult.NextLink == nil || len(*p.current.SSHPublicKeysGroupListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current SSHPublicKeysListBySubscriptionResponse page. +func (p *SSHPublicKeysListBySubscriptionPager) PageResponse() SSHPublicKeysListBySubscriptionResponse { + return p.current +} + +// SharedGalleriesListPager provides operations for iterating over paged responses. +type SharedGalleriesListPager struct { + client *SharedGalleriesClient + current SharedGalleriesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SharedGalleriesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SharedGalleriesListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SharedGalleriesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SharedGalleryList.NextLink == nil || len(*p.current.SharedGalleryList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current SharedGalleriesListResponse page. +func (p *SharedGalleriesListPager) PageResponse() SharedGalleriesListResponse { + return p.current +} + +// SharedGalleryImageVersionsListPager provides operations for iterating over paged responses. +type SharedGalleryImageVersionsListPager struct { + client *SharedGalleryImageVersionsClient + current SharedGalleryImageVersionsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SharedGalleryImageVersionsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SharedGalleryImageVersionsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SharedGalleryImageVersionsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SharedGalleryImageVersionList.NextLink == nil || len(*p.current.SharedGalleryImageVersionList.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -2195,16 +2208,16 @@ func (p *sharedGalleryListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -2213,51 +2226,83 @@ func (p *sharedGalleryListPager) NextPage(ctx context.Context) bool { return true } -func (p *sharedGalleryListPager) PageResponse() SharedGalleryListResponse { +// PageResponse returns the current SharedGalleryImageVersionsListResponse page. +func (p *SharedGalleryImageVersionsListPager) PageResponse() SharedGalleryImageVersionsListResponse { return p.current } -// SnapshotListPager provides iteration over SnapshotList pages. -type SnapshotListPager interface { - azcore.Pager - - // PageResponse returns the current SnapshotListResponse. - PageResponse() SnapshotListResponse +// SharedGalleryImagesListPager provides operations for iterating over paged responses. +type SharedGalleryImagesListPager struct { + client *SharedGalleryImagesClient + current SharedGalleryImagesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SharedGalleryImagesListResponse) (*policy.Request, error) } -type snapshotListCreateRequest func(context.Context) (*azcore.Request, error) - -type snapshotListHandleError func(*azcore.Response) error +// Err returns the last error encountered while paging. +func (p *SharedGalleryImagesListPager) Err() error { + return p.err +} -type snapshotListHandleResponse func(*azcore.Response) (SnapshotListResponse, error) +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SharedGalleryImagesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SharedGalleryImageList.NextLink == nil || len(*p.current.SharedGalleryImageList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} -type snapshotListAdvancePage func(context.Context, SnapshotListResponse) (*azcore.Request, error) +// PageResponse returns the current SharedGalleryImagesListResponse page. +func (p *SharedGalleryImagesListPager) PageResponse() SharedGalleryImagesListResponse { + return p.current +} -type snapshotListPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester snapshotListCreateRequest - // callback for handling response errors - errorer snapshotListHandleError - // callback for handling the HTTP response - responder snapshotListHandleResponse - // callback for advancing to the next page - advancer snapshotListAdvancePage - // contains the current response - current SnapshotListResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// SnapshotsListByResourceGroupPager provides operations for iterating over paged responses. +type SnapshotsListByResourceGroupPager struct { + client *SnapshotsClient + current SnapshotsListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SnapshotsListByResourceGroupResponse) (*policy.Request, error) } -func (p *snapshotListPager) Err() error { +// Err returns the last error encountered while paging. +func (p *SnapshotsListByResourceGroupPager) Err() error { return p.err } -func (p *snapshotListPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SnapshotsListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.SnapshotList.NextLink == nil || len(*p.current.SnapshotList.NextLink) == 0 { @@ -2271,16 +2316,16 @@ func (p *snapshotListPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByResourceGroupHandleResponse(resp) if err != nil { p.err = err return false @@ -2289,54 +2334,86 @@ func (p *snapshotListPager) NextPage(ctx context.Context) bool { return true } -func (p *snapshotListPager) PageResponse() SnapshotListResponse { +// PageResponse returns the current SnapshotsListByResourceGroupResponse page. +func (p *SnapshotsListByResourceGroupPager) PageResponse() SnapshotsListByResourceGroupResponse { return p.current } -// UpdateDomainListResultPager provides iteration over UpdateDomainListResult pages. -type UpdateDomainListResultPager interface { - azcore.Pager - - // PageResponse returns the current UpdateDomainListResultResponse. - PageResponse() UpdateDomainListResultResponse +// SnapshotsListPager provides operations for iterating over paged responses. +type SnapshotsListPager struct { + client *SnapshotsClient + current SnapshotsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SnapshotsListResponse) (*policy.Request, error) } -type updateDomainListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type updateDomainListResultHandleError func(*azcore.Response) error +// Err returns the last error encountered while paging. +func (p *SnapshotsListPager) Err() error { + return p.err +} -type updateDomainListResultHandleResponse func(*azcore.Response) (UpdateDomainListResultResponse, error) +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SnapshotsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SnapshotList.NextLink == nil || len(*p.current.SnapshotList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} -type updateDomainListResultAdvancePage func(context.Context, UpdateDomainListResultResponse) (*azcore.Request, error) +// PageResponse returns the current SnapshotsListResponse page. +func (p *SnapshotsListPager) PageResponse() SnapshotsListResponse { + return p.current +} -type updateDomainListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester updateDomainListResultCreateRequest - // callback for handling response errors - errorer updateDomainListResultHandleError - // callback for handling the HTTP response - responder updateDomainListResultHandleResponse - // callback for advancing to the next page - advancer updateDomainListResultAdvancePage - // contains the current response - current UpdateDomainListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// UsageListPager provides operations for iterating over paged responses. +type UsageListPager struct { + client *UsageClient + current UsageListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, UsageListResponse) (*policy.Request, error) } -func (p *updateDomainListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *UsageListPager) Err() error { return p.err } -func (p *updateDomainListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *UsageListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.UpdateDomainListResult.NextLink == nil || len(*p.current.UpdateDomainListResult.NextLink) == 0 { + if p.current.ListUsagesResult.NextLink == nil || len(*p.current.ListUsagesResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -2347,16 +2424,16 @@ func (p *updateDomainListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -2365,54 +2442,86 @@ func (p *updateDomainListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *updateDomainListResultPager) PageResponse() UpdateDomainListResultResponse { +// PageResponse returns the current UsageListResponse page. +func (p *UsageListPager) PageResponse() UsageListResponse { return p.current } -// VirtualMachineListResultPager provides iteration over VirtualMachineListResult pages. -type VirtualMachineListResultPager interface { - azcore.Pager - - // PageResponse returns the current VirtualMachineListResultResponse. - PageResponse() VirtualMachineListResultResponse +// VirtualMachineRunCommandsListByVirtualMachinePager provides operations for iterating over paged responses. +type VirtualMachineRunCommandsListByVirtualMachinePager struct { + client *VirtualMachineRunCommandsClient + current VirtualMachineRunCommandsListByVirtualMachineResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachineRunCommandsListByVirtualMachineResponse) (*policy.Request, error) } -type virtualMachineListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type virtualMachineListResultHandleError func(*azcore.Response) error +// Err returns the last error encountered while paging. +func (p *VirtualMachineRunCommandsListByVirtualMachinePager) Err() error { + return p.err +} -type virtualMachineListResultHandleResponse func(*azcore.Response) (VirtualMachineListResultResponse, error) +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachineRunCommandsListByVirtualMachinePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.VirtualMachineRunCommandsListResult.NextLink == nil || len(*p.current.VirtualMachineRunCommandsListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByVirtualMachineHandleError(resp) + return false + } + result, err := p.client.listByVirtualMachineHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} -type virtualMachineListResultAdvancePage func(context.Context, VirtualMachineListResultResponse) (*azcore.Request, error) +// PageResponse returns the current VirtualMachineRunCommandsListByVirtualMachineResponse page. +func (p *VirtualMachineRunCommandsListByVirtualMachinePager) PageResponse() VirtualMachineRunCommandsListByVirtualMachineResponse { + return p.current +} -type virtualMachineListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester virtualMachineListResultCreateRequest - // callback for handling response errors - errorer virtualMachineListResultHandleError - // callback for handling the HTTP response - responder virtualMachineListResultHandleResponse - // callback for advancing to the next page - advancer virtualMachineListResultAdvancePage - // contains the current response - current VirtualMachineListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// VirtualMachineRunCommandsListPager provides operations for iterating over paged responses. +type VirtualMachineRunCommandsListPager struct { + client *VirtualMachineRunCommandsClient + current VirtualMachineRunCommandsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachineRunCommandsListResponse) (*policy.Request, error) } -func (p *virtualMachineListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *VirtualMachineRunCommandsListPager) Err() error { return p.err } -func (p *virtualMachineListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachineRunCommandsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.VirtualMachineListResult.NextLink == nil || len(*p.current.VirtualMachineListResult.NextLink) == 0 { + if p.current.RunCommandListResult.NextLink == nil || len(*p.current.RunCommandListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -2423,16 +2532,16 @@ func (p *virtualMachineListResultPager) NextPage(ctx context.Context) bool { p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -2441,51 +2550,83 @@ func (p *virtualMachineListResultPager) NextPage(ctx context.Context) bool { return true } -func (p *virtualMachineListResultPager) PageResponse() VirtualMachineListResultResponse { +// PageResponse returns the current VirtualMachineRunCommandsListResponse page. +func (p *VirtualMachineRunCommandsListPager) PageResponse() VirtualMachineRunCommandsListResponse { return p.current } -// VirtualMachineRunCommandsListResultPager provides iteration over VirtualMachineRunCommandsListResult pages. -type VirtualMachineRunCommandsListResultPager interface { - azcore.Pager - - // PageResponse returns the current VirtualMachineRunCommandsListResultResponse. - PageResponse() VirtualMachineRunCommandsListResultResponse +// VirtualMachineScaleSetExtensionsListPager provides operations for iterating over paged responses. +type VirtualMachineScaleSetExtensionsListPager struct { + client *VirtualMachineScaleSetExtensionsClient + current VirtualMachineScaleSetExtensionsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachineScaleSetExtensionsListResponse) (*policy.Request, error) } -type virtualMachineRunCommandsListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type virtualMachineRunCommandsListResultHandleError func(*azcore.Response) error +// Err returns the last error encountered while paging. +func (p *VirtualMachineScaleSetExtensionsListPager) Err() error { + return p.err +} -type virtualMachineRunCommandsListResultHandleResponse func(*azcore.Response) (VirtualMachineRunCommandsListResultResponse, error) +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachineScaleSetExtensionsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.VirtualMachineScaleSetExtensionListResult.NextLink == nil || len(*p.current.VirtualMachineScaleSetExtensionListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} -type virtualMachineRunCommandsListResultAdvancePage func(context.Context, VirtualMachineRunCommandsListResultResponse) (*azcore.Request, error) +// PageResponse returns the current VirtualMachineScaleSetExtensionsListResponse page. +func (p *VirtualMachineScaleSetExtensionsListPager) PageResponse() VirtualMachineScaleSetExtensionsListResponse { + return p.current +} -type virtualMachineRunCommandsListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester virtualMachineRunCommandsListResultCreateRequest - // callback for handling response errors - errorer virtualMachineRunCommandsListResultHandleError - // callback for handling the HTTP response - responder virtualMachineRunCommandsListResultHandleResponse - // callback for advancing to the next page - advancer virtualMachineRunCommandsListResultAdvancePage - // contains the current response - current VirtualMachineRunCommandsListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// VirtualMachineScaleSetVMRunCommandsListPager provides operations for iterating over paged responses. +type VirtualMachineScaleSetVMRunCommandsListPager struct { + client *VirtualMachineScaleSetVMRunCommandsClient + current VirtualMachineScaleSetVMRunCommandsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachineScaleSetVMRunCommandsListResponse) (*policy.Request, error) } -func (p *virtualMachineRunCommandsListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *VirtualMachineScaleSetVMRunCommandsListPager) Err() error { return p.err } -func (p *virtualMachineRunCommandsListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachineScaleSetVMRunCommandsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.VirtualMachineRunCommandsListResult.NextLink == nil || len(*p.current.VirtualMachineRunCommandsListResult.NextLink) == 0 { @@ -2499,16 +2640,16 @@ func (p *virtualMachineRunCommandsListResultPager) NextPage(ctx context.Context) p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -2517,54 +2658,32 @@ func (p *virtualMachineRunCommandsListResultPager) NextPage(ctx context.Context) return true } -func (p *virtualMachineRunCommandsListResultPager) PageResponse() VirtualMachineRunCommandsListResultResponse { +// PageResponse returns the current VirtualMachineScaleSetVMRunCommandsListResponse page. +func (p *VirtualMachineScaleSetVMRunCommandsListPager) PageResponse() VirtualMachineScaleSetVMRunCommandsListResponse { return p.current } -// VirtualMachineScaleSetExtensionListResultPager provides iteration over VirtualMachineScaleSetExtensionListResult pages. -type VirtualMachineScaleSetExtensionListResultPager interface { - azcore.Pager - - // PageResponse returns the current VirtualMachineScaleSetExtensionListResultResponse. - PageResponse() VirtualMachineScaleSetExtensionListResultResponse -} - -type virtualMachineScaleSetExtensionListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type virtualMachineScaleSetExtensionListResultHandleError func(*azcore.Response) error - -type virtualMachineScaleSetExtensionListResultHandleResponse func(*azcore.Response) (VirtualMachineScaleSetExtensionListResultResponse, error) - -type virtualMachineScaleSetExtensionListResultAdvancePage func(context.Context, VirtualMachineScaleSetExtensionListResultResponse) (*azcore.Request, error) - -type virtualMachineScaleSetExtensionListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester virtualMachineScaleSetExtensionListResultCreateRequest - // callback for handling response errors - errorer virtualMachineScaleSetExtensionListResultHandleError - // callback for handling the HTTP response - responder virtualMachineScaleSetExtensionListResultHandleResponse - // callback for advancing to the next page - advancer virtualMachineScaleSetExtensionListResultAdvancePage - // contains the current response - current VirtualMachineScaleSetExtensionListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// VirtualMachineScaleSetVMsListPager provides operations for iterating over paged responses. +type VirtualMachineScaleSetVMsListPager struct { + client *VirtualMachineScaleSetVMsClient + current VirtualMachineScaleSetVMsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachineScaleSetVMsListResponse) (*policy.Request, error) } -func (p *virtualMachineScaleSetExtensionListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *VirtualMachineScaleSetVMsListPager) Err() error { return p.err } -func (p *virtualMachineScaleSetExtensionListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachineScaleSetVMsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.VirtualMachineScaleSetExtensionListResult.NextLink == nil || len(*p.current.VirtualMachineScaleSetExtensionListResult.NextLink) == 0 { + if p.current.VirtualMachineScaleSetVMListResult.NextLink == nil || len(*p.current.VirtualMachineScaleSetVMListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -2575,16 +2694,16 @@ func (p *virtualMachineScaleSetExtensionListResultPager) NextPage(ctx context.Co p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -2593,51 +2712,29 @@ func (p *virtualMachineScaleSetExtensionListResultPager) NextPage(ctx context.Co return true } -func (p *virtualMachineScaleSetExtensionListResultPager) PageResponse() VirtualMachineScaleSetExtensionListResultResponse { +// PageResponse returns the current VirtualMachineScaleSetVMsListResponse page. +func (p *VirtualMachineScaleSetVMsListPager) PageResponse() VirtualMachineScaleSetVMsListResponse { return p.current } -// VirtualMachineScaleSetListOSUpgradeHistoryPager provides iteration over VirtualMachineScaleSetListOSUpgradeHistory pages. -type VirtualMachineScaleSetListOSUpgradeHistoryPager interface { - azcore.Pager - - // PageResponse returns the current VirtualMachineScaleSetListOSUpgradeHistoryResponse. - PageResponse() VirtualMachineScaleSetListOSUpgradeHistoryResponse -} - -type virtualMachineScaleSetListOSUpgradeHistoryCreateRequest func(context.Context) (*azcore.Request, error) - -type virtualMachineScaleSetListOSUpgradeHistoryHandleError func(*azcore.Response) error - -type virtualMachineScaleSetListOSUpgradeHistoryHandleResponse func(*azcore.Response) (VirtualMachineScaleSetListOSUpgradeHistoryResponse, error) - -type virtualMachineScaleSetListOSUpgradeHistoryAdvancePage func(context.Context, VirtualMachineScaleSetListOSUpgradeHistoryResponse) (*azcore.Request, error) - -type virtualMachineScaleSetListOSUpgradeHistoryPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester virtualMachineScaleSetListOSUpgradeHistoryCreateRequest - // callback for handling response errors - errorer virtualMachineScaleSetListOSUpgradeHistoryHandleError - // callback for handling the HTTP response - responder virtualMachineScaleSetListOSUpgradeHistoryHandleResponse - // callback for advancing to the next page - advancer virtualMachineScaleSetListOSUpgradeHistoryAdvancePage - // contains the current response - current VirtualMachineScaleSetListOSUpgradeHistoryResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// VirtualMachineScaleSetsGetOSUpgradeHistoryPager provides operations for iterating over paged responses. +type VirtualMachineScaleSetsGetOSUpgradeHistoryPager struct { + client *VirtualMachineScaleSetsClient + current VirtualMachineScaleSetsGetOSUpgradeHistoryResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachineScaleSetsGetOSUpgradeHistoryResponse) (*policy.Request, error) } -func (p *virtualMachineScaleSetListOSUpgradeHistoryPager) Err() error { +// Err returns the last error encountered while paging. +func (p *VirtualMachineScaleSetsGetOSUpgradeHistoryPager) Err() error { return p.err } -func (p *virtualMachineScaleSetListOSUpgradeHistoryPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachineScaleSetsGetOSUpgradeHistoryPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.VirtualMachineScaleSetListOSUpgradeHistory.NextLink == nil || len(*p.current.VirtualMachineScaleSetListOSUpgradeHistory.NextLink) == 0 { @@ -2651,16 +2748,16 @@ func (p *virtualMachineScaleSetListOSUpgradeHistoryPager) NextPage(ctx context.C p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.getOSUpgradeHistoryHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.getOSUpgradeHistoryHandleResponse(resp) if err != nil { p.err = err return false @@ -2669,51 +2766,83 @@ func (p *virtualMachineScaleSetListOSUpgradeHistoryPager) NextPage(ctx context.C return true } -func (p *virtualMachineScaleSetListOSUpgradeHistoryPager) PageResponse() VirtualMachineScaleSetListOSUpgradeHistoryResponse { +// PageResponse returns the current VirtualMachineScaleSetsGetOSUpgradeHistoryResponse page. +func (p *VirtualMachineScaleSetsGetOSUpgradeHistoryPager) PageResponse() VirtualMachineScaleSetsGetOSUpgradeHistoryResponse { return p.current } -// VirtualMachineScaleSetListResultPager provides iteration over VirtualMachineScaleSetListResult pages. -type VirtualMachineScaleSetListResultPager interface { - azcore.Pager - - // PageResponse returns the current VirtualMachineScaleSetListResultResponse. - PageResponse() VirtualMachineScaleSetListResultResponse +// VirtualMachineScaleSetsListAllPager provides operations for iterating over paged responses. +type VirtualMachineScaleSetsListAllPager struct { + client *VirtualMachineScaleSetsClient + current VirtualMachineScaleSetsListAllResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachineScaleSetsListAllResponse) (*policy.Request, error) } -type virtualMachineScaleSetListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type virtualMachineScaleSetListResultHandleError func(*azcore.Response) error +// Err returns the last error encountered while paging. +func (p *VirtualMachineScaleSetsListAllPager) Err() error { + return p.err +} -type virtualMachineScaleSetListResultHandleResponse func(*azcore.Response) (VirtualMachineScaleSetListResultResponse, error) +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachineScaleSetsListAllPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.VirtualMachineScaleSetListWithLinkResult.NextLink == nil || len(*p.current.VirtualMachineScaleSetListWithLinkResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listAllHandleError(resp) + return false + } + result, err := p.client.listAllHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} -type virtualMachineScaleSetListResultAdvancePage func(context.Context, VirtualMachineScaleSetListResultResponse) (*azcore.Request, error) +// PageResponse returns the current VirtualMachineScaleSetsListAllResponse page. +func (p *VirtualMachineScaleSetsListAllPager) PageResponse() VirtualMachineScaleSetsListAllResponse { + return p.current +} -type virtualMachineScaleSetListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester virtualMachineScaleSetListResultCreateRequest - // callback for handling response errors - errorer virtualMachineScaleSetListResultHandleError - // callback for handling the HTTP response - responder virtualMachineScaleSetListResultHandleResponse - // callback for advancing to the next page - advancer virtualMachineScaleSetListResultAdvancePage - // contains the current response - current VirtualMachineScaleSetListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// VirtualMachineScaleSetsListByLocationPager provides operations for iterating over paged responses. +type VirtualMachineScaleSetsListByLocationPager struct { + client *VirtualMachineScaleSetsClient + current VirtualMachineScaleSetsListByLocationResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachineScaleSetsListByLocationResponse) (*policy.Request, error) } -func (p *virtualMachineScaleSetListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *VirtualMachineScaleSetsListByLocationPager) Err() error { return p.err } -func (p *virtualMachineScaleSetListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachineScaleSetsListByLocationPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.VirtualMachineScaleSetListResult.NextLink == nil || len(*p.current.VirtualMachineScaleSetListResult.NextLink) == 0 { @@ -2727,16 +2856,16 @@ func (p *virtualMachineScaleSetListResultPager) NextPage(ctx context.Context) bo p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByLocationHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listByLocationHandleResponse(resp) if err != nil { p.err = err return false @@ -2745,51 +2874,83 @@ func (p *virtualMachineScaleSetListResultPager) NextPage(ctx context.Context) bo return true } -func (p *virtualMachineScaleSetListResultPager) PageResponse() VirtualMachineScaleSetListResultResponse { +// PageResponse returns the current VirtualMachineScaleSetsListByLocationResponse page. +func (p *VirtualMachineScaleSetsListByLocationPager) PageResponse() VirtualMachineScaleSetsListByLocationResponse { return p.current } -// VirtualMachineScaleSetListSKUsResultPager provides iteration over VirtualMachineScaleSetListSKUsResult pages. -type VirtualMachineScaleSetListSKUsResultPager interface { - azcore.Pager - - // PageResponse returns the current VirtualMachineScaleSetListSKUsResultResponse. - PageResponse() VirtualMachineScaleSetListSKUsResultResponse +// VirtualMachineScaleSetsListPager provides operations for iterating over paged responses. +type VirtualMachineScaleSetsListPager struct { + client *VirtualMachineScaleSetsClient + current VirtualMachineScaleSetsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachineScaleSetsListResponse) (*policy.Request, error) } -type virtualMachineScaleSetListSKUsResultCreateRequest func(context.Context) (*azcore.Request, error) - -type virtualMachineScaleSetListSKUsResultHandleError func(*azcore.Response) error +// Err returns the last error encountered while paging. +func (p *VirtualMachineScaleSetsListPager) Err() error { + return p.err +} -type virtualMachineScaleSetListSKUsResultHandleResponse func(*azcore.Response) (VirtualMachineScaleSetListSKUsResultResponse, error) +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachineScaleSetsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.VirtualMachineScaleSetListResult.NextLink == nil || len(*p.current.VirtualMachineScaleSetListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} -type virtualMachineScaleSetListSKUsResultAdvancePage func(context.Context, VirtualMachineScaleSetListSKUsResultResponse) (*azcore.Request, error) +// PageResponse returns the current VirtualMachineScaleSetsListResponse page. +func (p *VirtualMachineScaleSetsListPager) PageResponse() VirtualMachineScaleSetsListResponse { + return p.current +} -type virtualMachineScaleSetListSKUsResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester virtualMachineScaleSetListSKUsResultCreateRequest - // callback for handling response errors - errorer virtualMachineScaleSetListSKUsResultHandleError - // callback for handling the HTTP response - responder virtualMachineScaleSetListSKUsResultHandleResponse - // callback for advancing to the next page - advancer virtualMachineScaleSetListSKUsResultAdvancePage - // contains the current response - current VirtualMachineScaleSetListSKUsResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// VirtualMachineScaleSetsListSKUsPager provides operations for iterating over paged responses. +type VirtualMachineScaleSetsListSKUsPager struct { + client *VirtualMachineScaleSetsClient + current VirtualMachineScaleSetsListSKUsResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachineScaleSetsListSKUsResponse) (*policy.Request, error) } -func (p *virtualMachineScaleSetListSKUsResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *VirtualMachineScaleSetsListSKUsPager) Err() error { return p.err } -func (p *virtualMachineScaleSetListSKUsResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachineScaleSetsListSKUsPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { if p.current.VirtualMachineScaleSetListSKUsResult.NextLink == nil || len(*p.current.VirtualMachineScaleSetListSKUsResult.NextLink) == 0 { @@ -2803,16 +2964,16 @@ func (p *virtualMachineScaleSetListSKUsResultPager) NextPage(ctx context.Context p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listSKUsHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listSKUsHandleResponse(resp) if err != nil { p.err = err return false @@ -2821,54 +2982,32 @@ func (p *virtualMachineScaleSetListSKUsResultPager) NextPage(ctx context.Context return true } -func (p *virtualMachineScaleSetListSKUsResultPager) PageResponse() VirtualMachineScaleSetListSKUsResultResponse { +// PageResponse returns the current VirtualMachineScaleSetsListSKUsResponse page. +func (p *VirtualMachineScaleSetsListSKUsPager) PageResponse() VirtualMachineScaleSetsListSKUsResponse { return p.current } -// VirtualMachineScaleSetListWithLinkResultPager provides iteration over VirtualMachineScaleSetListWithLinkResult pages. -type VirtualMachineScaleSetListWithLinkResultPager interface { - azcore.Pager - - // PageResponse returns the current VirtualMachineScaleSetListWithLinkResultResponse. - PageResponse() VirtualMachineScaleSetListWithLinkResultResponse -} - -type virtualMachineScaleSetListWithLinkResultCreateRequest func(context.Context) (*azcore.Request, error) - -type virtualMachineScaleSetListWithLinkResultHandleError func(*azcore.Response) error - -type virtualMachineScaleSetListWithLinkResultHandleResponse func(*azcore.Response) (VirtualMachineScaleSetListWithLinkResultResponse, error) - -type virtualMachineScaleSetListWithLinkResultAdvancePage func(context.Context, VirtualMachineScaleSetListWithLinkResultResponse) (*azcore.Request, error) - -type virtualMachineScaleSetListWithLinkResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester virtualMachineScaleSetListWithLinkResultCreateRequest - // callback for handling response errors - errorer virtualMachineScaleSetListWithLinkResultHandleError - // callback for handling the HTTP response - responder virtualMachineScaleSetListWithLinkResultHandleResponse - // callback for advancing to the next page - advancer virtualMachineScaleSetListWithLinkResultAdvancePage - // contains the current response - current VirtualMachineScaleSetListWithLinkResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// VirtualMachinesListAllPager provides operations for iterating over paged responses. +type VirtualMachinesListAllPager struct { + client *VirtualMachinesClient + current VirtualMachinesListAllResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachinesListAllResponse) (*policy.Request, error) } -func (p *virtualMachineScaleSetListWithLinkResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *VirtualMachinesListAllPager) Err() error { return p.err } -func (p *virtualMachineScaleSetListWithLinkResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachinesListAllPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.VirtualMachineScaleSetListWithLinkResult.NextLink == nil || len(*p.current.VirtualMachineScaleSetListWithLinkResult.NextLink) == 0 { + if p.current.VirtualMachineListResult.NextLink == nil || len(*p.current.VirtualMachineListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -2879,16 +3018,16 @@ func (p *virtualMachineScaleSetListWithLinkResultPager) NextPage(ctx context.Con p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listAllHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listAllHandleResponse(resp) if err != nil { p.err = err return false @@ -2897,54 +3036,86 @@ func (p *virtualMachineScaleSetListWithLinkResultPager) NextPage(ctx context.Con return true } -func (p *virtualMachineScaleSetListWithLinkResultPager) PageResponse() VirtualMachineScaleSetListWithLinkResultResponse { +// PageResponse returns the current VirtualMachinesListAllResponse page. +func (p *VirtualMachinesListAllPager) PageResponse() VirtualMachinesListAllResponse { return p.current } -// VirtualMachineScaleSetVMListResultPager provides iteration over VirtualMachineScaleSetVMListResult pages. -type VirtualMachineScaleSetVMListResultPager interface { - azcore.Pager - - // PageResponse returns the current VirtualMachineScaleSetVMListResultResponse. - PageResponse() VirtualMachineScaleSetVMListResultResponse +// VirtualMachinesListByLocationPager provides operations for iterating over paged responses. +type VirtualMachinesListByLocationPager struct { + client *VirtualMachinesClient + current VirtualMachinesListByLocationResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachinesListByLocationResponse) (*policy.Request, error) } -type virtualMachineScaleSetVMListResultCreateRequest func(context.Context) (*azcore.Request, error) - -type virtualMachineScaleSetVMListResultHandleError func(*azcore.Response) error +// Err returns the last error encountered while paging. +func (p *VirtualMachinesListByLocationPager) Err() error { + return p.err +} -type virtualMachineScaleSetVMListResultHandleResponse func(*azcore.Response) (VirtualMachineScaleSetVMListResultResponse, error) +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachinesListByLocationPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.VirtualMachineListResult.NextLink == nil || len(*p.current.VirtualMachineListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByLocationHandleError(resp) + return false + } + result, err := p.client.listByLocationHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} -type virtualMachineScaleSetVMListResultAdvancePage func(context.Context, VirtualMachineScaleSetVMListResultResponse) (*azcore.Request, error) +// PageResponse returns the current VirtualMachinesListByLocationResponse page. +func (p *VirtualMachinesListByLocationPager) PageResponse() VirtualMachinesListByLocationResponse { + return p.current +} -type virtualMachineScaleSetVMListResultPager struct { - // the pipeline for making the request - pipeline azcore.Pipeline - // creates the initial request (non-LRO case) - requester virtualMachineScaleSetVMListResultCreateRequest - // callback for handling response errors - errorer virtualMachineScaleSetVMListResultHandleError - // callback for handling the HTTP response - responder virtualMachineScaleSetVMListResultHandleResponse - // callback for advancing to the next page - advancer virtualMachineScaleSetVMListResultAdvancePage - // contains the current response - current VirtualMachineScaleSetVMListResultResponse - // status codes for successful retrieval - statusCodes []int - // any error encountered - err error +// VirtualMachinesListPager provides operations for iterating over paged responses. +type VirtualMachinesListPager struct { + client *VirtualMachinesClient + current VirtualMachinesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, VirtualMachinesListResponse) (*policy.Request, error) } -func (p *virtualMachineScaleSetVMListResultPager) Err() error { +// Err returns the last error encountered while paging. +func (p *VirtualMachinesListPager) Err() error { return p.err } -func (p *virtualMachineScaleSetVMListResultPager) NextPage(ctx context.Context) bool { - var req *azcore.Request +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *VirtualMachinesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request var err error if !reflect.ValueOf(p.current).IsZero() { - if p.current.VirtualMachineScaleSetVMListResult.NextLink == nil || len(*p.current.VirtualMachineScaleSetVMListResult.NextLink) == 0 { + if p.current.VirtualMachineListResult.NextLink == nil || len(*p.current.VirtualMachineListResult.NextLink) == 0 { return false } req, err = p.advancer(ctx, p.current) @@ -2955,16 +3126,16 @@ func (p *virtualMachineScaleSetVMListResultPager) NextPage(ctx context.Context) p.err = err return false } - resp, err := p.pipeline.Do(req) + resp, err := p.client.pl.Do(req) if err != nil { p.err = err return false } - if !resp.HasStatusCode(p.statusCodes...) { - p.err = p.errorer(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) return false } - result, err := p.responder(resp) + result, err := p.client.listHandleResponse(resp) if err != nil { p.err = err return false @@ -2973,6 +3144,7 @@ func (p *virtualMachineScaleSetVMListResultPager) NextPage(ctx context.Context) return true } -func (p *virtualMachineScaleSetVMListResultPager) PageResponse() VirtualMachineScaleSetVMListResultResponse { +// PageResponse returns the current VirtualMachinesListResponse page. +func (p *VirtualMachinesListPager) PageResponse() VirtualMachinesListResponse { return p.current } diff --git a/sdk/compute/armcompute/zz_generated_pollers.go b/sdk/compute/armcompute/zz_generated_pollers.go index 09383db0fce1..41bb4bc6041f 100644 --- a/sdk/compute/armcompute/zz_generated_pollers.go +++ b/sdk/compute/armcompute/zz_generated_pollers.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -9,1301 +10,5296 @@ package armcompute import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" - "time" -) -// AccessURIPoller provides polling facilities until the operation reaches a terminal state. -type AccessURIPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final AccessURIResponse will be returned. - FinalResponse(ctx context.Context) (AccessURIResponse, error) -} + "github.com/Azure/azure-sdk-for-go/sdk/azcore" +) -type accessURIPoller struct { - pt *armcore.LROPoller +// CapacityReservationsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type CapacityReservationsCreateOrUpdatePoller struct { + pt *azcore.Poller } -func (p *accessURIPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *CapacityReservationsCreateOrUpdatePoller) Done() bool { return p.pt.Done() } -func (p *accessURIPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CapacityReservationsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *accessURIPoller) FinalResponse(ctx context.Context) (AccessURIResponse, error) { - respType := AccessURIResponse{AccessURI: &AccessURI{}} - resp, err := p.pt.FinalResponse(ctx, respType.AccessURI) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CapacityReservationsCreateOrUpdateResponse will be returned. +func (p *CapacityReservationsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (CapacityReservationsCreateOrUpdateResponse, error) { + respType := CapacityReservationsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.CapacityReservation) if err != nil { - return AccessURIResponse{}, err + return CapacityReservationsCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *accessURIPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CapacityReservationsCreateOrUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *accessURIPoller) pollUntilDone(ctx context.Context, freq time.Duration) (AccessURIResponse, error) { - respType := AccessURIResponse{AccessURI: &AccessURI{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.AccessURI) +// CapacityReservationsDeletePoller provides polling facilities until the operation reaches a terminal state. +type CapacityReservationsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CapacityReservationsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CapacityReservationsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CapacityReservationsDeleteResponse will be returned. +func (p *CapacityReservationsDeletePoller) FinalResponse(ctx context.Context) (CapacityReservationsDeleteResponse, error) { + respType := CapacityReservationsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return AccessURIResponse{}, err + return CapacityReservationsDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -// CloudServicePoller provides polling facilities until the operation reaches a terminal state. -type CloudServicePoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final CloudServiceResponse will be returned. - FinalResponse(ctx context.Context) (CloudServiceResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CapacityReservationsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type cloudServicePoller struct { - pt *armcore.LROPoller +// CapacityReservationsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type CapacityReservationsUpdatePoller struct { + pt *azcore.Poller } -func (p *cloudServicePoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *CapacityReservationsUpdatePoller) Done() bool { return p.pt.Done() } -func (p *cloudServicePoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CapacityReservationsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *cloudServicePoller) FinalResponse(ctx context.Context) (CloudServiceResponse, error) { - respType := CloudServiceResponse{CloudService: &CloudService{}} - resp, err := p.pt.FinalResponse(ctx, respType.CloudService) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CapacityReservationsUpdateResponse will be returned. +func (p *CapacityReservationsUpdatePoller) FinalResponse(ctx context.Context) (CapacityReservationsUpdateResponse, error) { + respType := CapacityReservationsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.CapacityReservation) if err != nil { - return CloudServiceResponse{}, err + return CapacityReservationsUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *cloudServicePoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CapacityReservationsUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *cloudServicePoller) pollUntilDone(ctx context.Context, freq time.Duration) (CloudServiceResponse, error) { - respType := CloudServiceResponse{CloudService: &CloudService{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.CloudService) +// CloudServiceRoleInstancesDeletePoller provides polling facilities until the operation reaches a terminal state. +type CloudServiceRoleInstancesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServiceRoleInstancesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServiceRoleInstancesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServiceRoleInstancesDeleteResponse will be returned. +func (p *CloudServiceRoleInstancesDeletePoller) FinalResponse(ctx context.Context) (CloudServiceRoleInstancesDeleteResponse, error) { + respType := CloudServiceRoleInstancesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return CloudServiceResponse{}, err + return CloudServiceRoleInstancesDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -// DedicatedHostPoller provides polling facilities until the operation reaches a terminal state. -type DedicatedHostPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final DedicatedHostResponse will be returned. - FinalResponse(ctx context.Context) (DedicatedHostResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServiceRoleInstancesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type dedicatedHostPoller struct { - pt *armcore.LROPoller +// CloudServiceRoleInstancesRebuildPoller provides polling facilities until the operation reaches a terminal state. +type CloudServiceRoleInstancesRebuildPoller struct { + pt *azcore.Poller } -func (p *dedicatedHostPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServiceRoleInstancesRebuildPoller) Done() bool { return p.pt.Done() } -func (p *dedicatedHostPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServiceRoleInstancesRebuildPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *dedicatedHostPoller) FinalResponse(ctx context.Context) (DedicatedHostResponse, error) { - respType := DedicatedHostResponse{DedicatedHost: &DedicatedHost{}} - resp, err := p.pt.FinalResponse(ctx, respType.DedicatedHost) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServiceRoleInstancesRebuildResponse will be returned. +func (p *CloudServiceRoleInstancesRebuildPoller) FinalResponse(ctx context.Context) (CloudServiceRoleInstancesRebuildResponse, error) { + respType := CloudServiceRoleInstancesRebuildResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return DedicatedHostResponse{}, err + return CloudServiceRoleInstancesRebuildResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *dedicatedHostPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServiceRoleInstancesRebuildPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *dedicatedHostPoller) pollUntilDone(ctx context.Context, freq time.Duration) (DedicatedHostResponse, error) { - respType := DedicatedHostResponse{DedicatedHost: &DedicatedHost{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.DedicatedHost) +// CloudServiceRoleInstancesReimagePoller provides polling facilities until the operation reaches a terminal state. +type CloudServiceRoleInstancesReimagePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServiceRoleInstancesReimagePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServiceRoleInstancesReimagePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServiceRoleInstancesReimageResponse will be returned. +func (p *CloudServiceRoleInstancesReimagePoller) FinalResponse(ctx context.Context) (CloudServiceRoleInstancesReimageResponse, error) { + respType := CloudServiceRoleInstancesReimageResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return DedicatedHostResponse{}, err + return CloudServiceRoleInstancesReimageResponse{}, err } respType.RawResponse = resp return respType, nil } -// DiskAccessPoller provides polling facilities until the operation reaches a terminal state. -type DiskAccessPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final DiskAccessResponse will be returned. - FinalResponse(ctx context.Context) (DiskAccessResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServiceRoleInstancesReimagePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type diskAccessPoller struct { - pt *armcore.LROPoller +// CloudServiceRoleInstancesRestartPoller provides polling facilities until the operation reaches a terminal state. +type CloudServiceRoleInstancesRestartPoller struct { + pt *azcore.Poller } -func (p *diskAccessPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServiceRoleInstancesRestartPoller) Done() bool { return p.pt.Done() } -func (p *diskAccessPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServiceRoleInstancesRestartPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *diskAccessPoller) FinalResponse(ctx context.Context) (DiskAccessResponse, error) { - respType := DiskAccessResponse{DiskAccess: &DiskAccess{}} - resp, err := p.pt.FinalResponse(ctx, respType.DiskAccess) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServiceRoleInstancesRestartResponse will be returned. +func (p *CloudServiceRoleInstancesRestartPoller) FinalResponse(ctx context.Context) (CloudServiceRoleInstancesRestartResponse, error) { + respType := CloudServiceRoleInstancesRestartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return DiskAccessResponse{}, err + return CloudServiceRoleInstancesRestartResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *diskAccessPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServiceRoleInstancesRestartPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *diskAccessPoller) pollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessResponse, error) { - respType := DiskAccessResponse{DiskAccess: &DiskAccess{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.DiskAccess) +// CloudServicesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type CloudServicesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServicesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServicesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServicesCreateOrUpdateResponse will be returned. +func (p *CloudServicesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (CloudServicesCreateOrUpdateResponse, error) { + respType := CloudServicesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.CloudService) if err != nil { - return DiskAccessResponse{}, err + return CloudServicesCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// DiskEncryptionSetPoller provides polling facilities until the operation reaches a terminal state. -type DiskEncryptionSetPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final DiskEncryptionSetResponse will be returned. - FinalResponse(ctx context.Context) (DiskEncryptionSetResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServicesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type diskEncryptionSetPoller struct { - pt *armcore.LROPoller +// CloudServicesDeleteInstancesPoller provides polling facilities until the operation reaches a terminal state. +type CloudServicesDeleteInstancesPoller struct { + pt *azcore.Poller } -func (p *diskEncryptionSetPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServicesDeleteInstancesPoller) Done() bool { return p.pt.Done() } -func (p *diskEncryptionSetPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServicesDeleteInstancesPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *diskEncryptionSetPoller) FinalResponse(ctx context.Context) (DiskEncryptionSetResponse, error) { - respType := DiskEncryptionSetResponse{DiskEncryptionSet: &DiskEncryptionSet{}} - resp, err := p.pt.FinalResponse(ctx, respType.DiskEncryptionSet) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServicesDeleteInstancesResponse will be returned. +func (p *CloudServicesDeleteInstancesPoller) FinalResponse(ctx context.Context) (CloudServicesDeleteInstancesResponse, error) { + respType := CloudServicesDeleteInstancesResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return DiskEncryptionSetResponse{}, err + return CloudServicesDeleteInstancesResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *diskEncryptionSetPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServicesDeleteInstancesPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *diskEncryptionSetPoller) pollUntilDone(ctx context.Context, freq time.Duration) (DiskEncryptionSetResponse, error) { - respType := DiskEncryptionSetResponse{DiskEncryptionSet: &DiskEncryptionSet{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.DiskEncryptionSet) +// CloudServicesDeletePoller provides polling facilities until the operation reaches a terminal state. +type CloudServicesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServicesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServicesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServicesDeleteResponse will be returned. +func (p *CloudServicesDeletePoller) FinalResponse(ctx context.Context) (CloudServicesDeleteResponse, error) { + respType := CloudServicesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return DiskEncryptionSetResponse{}, err + return CloudServicesDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -// DiskPoller provides polling facilities until the operation reaches a terminal state. -type DiskPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final DiskResponse will be returned. - FinalResponse(ctx context.Context) (DiskResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServicesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type diskPoller struct { - pt *armcore.LROPoller +// CloudServicesPowerOffPoller provides polling facilities until the operation reaches a terminal state. +type CloudServicesPowerOffPoller struct { + pt *azcore.Poller } -func (p *diskPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServicesPowerOffPoller) Done() bool { return p.pt.Done() } -func (p *diskPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServicesPowerOffPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *diskPoller) FinalResponse(ctx context.Context) (DiskResponse, error) { - respType := DiskResponse{Disk: &Disk{}} - resp, err := p.pt.FinalResponse(ctx, respType.Disk) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServicesPowerOffResponse will be returned. +func (p *CloudServicesPowerOffPoller) FinalResponse(ctx context.Context) (CloudServicesPowerOffResponse, error) { + respType := CloudServicesPowerOffResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return DiskResponse{}, err + return CloudServicesPowerOffResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *diskPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServicesPowerOffPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *diskPoller) pollUntilDone(ctx context.Context, freq time.Duration) (DiskResponse, error) { - respType := DiskResponse{Disk: &Disk{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.Disk) +// CloudServicesRebuildPoller provides polling facilities until the operation reaches a terminal state. +type CloudServicesRebuildPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServicesRebuildPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServicesRebuildPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServicesRebuildResponse will be returned. +func (p *CloudServicesRebuildPoller) FinalResponse(ctx context.Context) (CloudServicesRebuildResponse, error) { + respType := CloudServicesRebuildResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return DiskResponse{}, err + return CloudServicesRebuildResponse{}, err } respType.RawResponse = resp return respType, nil } -// GalleryApplicationPoller provides polling facilities until the operation reaches a terminal state. -type GalleryApplicationPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final GalleryApplicationResponse will be returned. - FinalResponse(ctx context.Context) (GalleryApplicationResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServicesRebuildPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type galleryApplicationPoller struct { - pt *armcore.LROPoller +// CloudServicesReimagePoller provides polling facilities until the operation reaches a terminal state. +type CloudServicesReimagePoller struct { + pt *azcore.Poller } -func (p *galleryApplicationPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServicesReimagePoller) Done() bool { return p.pt.Done() } -func (p *galleryApplicationPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServicesReimagePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *galleryApplicationPoller) FinalResponse(ctx context.Context) (GalleryApplicationResponse, error) { - respType := GalleryApplicationResponse{GalleryApplication: &GalleryApplication{}} - resp, err := p.pt.FinalResponse(ctx, respType.GalleryApplication) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServicesReimageResponse will be returned. +func (p *CloudServicesReimagePoller) FinalResponse(ctx context.Context) (CloudServicesReimageResponse, error) { + respType := CloudServicesReimageResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return GalleryApplicationResponse{}, err + return CloudServicesReimageResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *galleryApplicationPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServicesReimagePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *galleryApplicationPoller) pollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationResponse, error) { - respType := GalleryApplicationResponse{GalleryApplication: &GalleryApplication{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.GalleryApplication) +// CloudServicesRestartPoller provides polling facilities until the operation reaches a terminal state. +type CloudServicesRestartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServicesRestartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServicesRestartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServicesRestartResponse will be returned. +func (p *CloudServicesRestartPoller) FinalResponse(ctx context.Context) (CloudServicesRestartResponse, error) { + respType := CloudServicesRestartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return GalleryApplicationResponse{}, err + return CloudServicesRestartResponse{}, err } respType.RawResponse = resp return respType, nil } -// GalleryApplicationVersionPoller provides polling facilities until the operation reaches a terminal state. -type GalleryApplicationVersionPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final GalleryApplicationVersionResponse will be returned. - FinalResponse(ctx context.Context) (GalleryApplicationVersionResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServicesRestartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type galleryApplicationVersionPoller struct { - pt *armcore.LROPoller +// CloudServicesStartPoller provides polling facilities until the operation reaches a terminal state. +type CloudServicesStartPoller struct { + pt *azcore.Poller } -func (p *galleryApplicationVersionPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServicesStartPoller) Done() bool { return p.pt.Done() } -func (p *galleryApplicationVersionPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServicesStartPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *galleryApplicationVersionPoller) FinalResponse(ctx context.Context) (GalleryApplicationVersionResponse, error) { - respType := GalleryApplicationVersionResponse{GalleryApplicationVersion: &GalleryApplicationVersion{}} - resp, err := p.pt.FinalResponse(ctx, respType.GalleryApplicationVersion) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServicesStartResponse will be returned. +func (p *CloudServicesStartPoller) FinalResponse(ctx context.Context) (CloudServicesStartResponse, error) { + respType := CloudServicesStartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return GalleryApplicationVersionResponse{}, err + return CloudServicesStartResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *galleryApplicationVersionPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServicesStartPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *galleryApplicationVersionPoller) pollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationVersionResponse, error) { - respType := GalleryApplicationVersionResponse{GalleryApplicationVersion: &GalleryApplicationVersion{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.GalleryApplicationVersion) +// CloudServicesUpdateDomainWalkUpdateDomainPoller provides polling facilities until the operation reaches a terminal state. +type CloudServicesUpdateDomainWalkUpdateDomainPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServicesUpdateDomainWalkUpdateDomainPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServicesUpdateDomainWalkUpdateDomainPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServicesUpdateDomainWalkUpdateDomainResponse will be returned. +func (p *CloudServicesUpdateDomainWalkUpdateDomainPoller) FinalResponse(ctx context.Context) (CloudServicesUpdateDomainWalkUpdateDomainResponse, error) { + respType := CloudServicesUpdateDomainWalkUpdateDomainResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return GalleryApplicationVersionResponse{}, err + return CloudServicesUpdateDomainWalkUpdateDomainResponse{}, err } respType.RawResponse = resp return respType, nil } -// GalleryImagePoller provides polling facilities until the operation reaches a terminal state. -type GalleryImagePoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final GalleryImageResponse will be returned. - FinalResponse(ctx context.Context) (GalleryImageResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServicesUpdateDomainWalkUpdateDomainPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type galleryImagePoller struct { - pt *armcore.LROPoller +// CloudServicesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type CloudServicesUpdatePoller struct { + pt *azcore.Poller } -func (p *galleryImagePoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *CloudServicesUpdatePoller) Done() bool { return p.pt.Done() } -func (p *galleryImagePoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CloudServicesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *galleryImagePoller) FinalResponse(ctx context.Context) (GalleryImageResponse, error) { - respType := GalleryImageResponse{GalleryImage: &GalleryImage{}} - resp, err := p.pt.FinalResponse(ctx, respType.GalleryImage) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CloudServicesUpdateResponse will be returned. +func (p *CloudServicesUpdatePoller) FinalResponse(ctx context.Context) (CloudServicesUpdateResponse, error) { + respType := CloudServicesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.CloudService) if err != nil { - return GalleryImageResponse{}, err + return CloudServicesUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *galleryImagePoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CloudServicesUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *galleryImagePoller) pollUntilDone(ctx context.Context, freq time.Duration) (GalleryImageResponse, error) { - respType := GalleryImageResponse{GalleryImage: &GalleryImage{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.GalleryImage) +// DedicatedHostsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DedicatedHostsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DedicatedHostsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DedicatedHostsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DedicatedHostsCreateOrUpdateResponse will be returned. +func (p *DedicatedHostsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (DedicatedHostsCreateOrUpdateResponse, error) { + respType := DedicatedHostsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.DedicatedHost) if err != nil { - return GalleryImageResponse{}, err + return DedicatedHostsCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// GalleryImageVersionPoller provides polling facilities until the operation reaches a terminal state. -type GalleryImageVersionPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final GalleryImageVersionResponse will be returned. - FinalResponse(ctx context.Context) (GalleryImageVersionResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DedicatedHostsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type galleryImageVersionPoller struct { - pt *armcore.LROPoller +// DedicatedHostsDeletePoller provides polling facilities until the operation reaches a terminal state. +type DedicatedHostsDeletePoller struct { + pt *azcore.Poller } -func (p *galleryImageVersionPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *DedicatedHostsDeletePoller) Done() bool { return p.pt.Done() } -func (p *galleryImageVersionPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DedicatedHostsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *galleryImageVersionPoller) FinalResponse(ctx context.Context) (GalleryImageVersionResponse, error) { - respType := GalleryImageVersionResponse{GalleryImageVersion: &GalleryImageVersion{}} - resp, err := p.pt.FinalResponse(ctx, respType.GalleryImageVersion) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DedicatedHostsDeleteResponse will be returned. +func (p *DedicatedHostsDeletePoller) FinalResponse(ctx context.Context) (DedicatedHostsDeleteResponse, error) { + respType := DedicatedHostsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return GalleryImageVersionResponse{}, err + return DedicatedHostsDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *galleryImageVersionPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DedicatedHostsDeletePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *galleryImageVersionPoller) pollUntilDone(ctx context.Context, freq time.Duration) (GalleryImageVersionResponse, error) { - respType := GalleryImageVersionResponse{GalleryImageVersion: &GalleryImageVersion{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.GalleryImageVersion) +// DedicatedHostsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DedicatedHostsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DedicatedHostsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DedicatedHostsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DedicatedHostsUpdateResponse will be returned. +func (p *DedicatedHostsUpdatePoller) FinalResponse(ctx context.Context) (DedicatedHostsUpdateResponse, error) { + respType := DedicatedHostsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.DedicatedHost) if err != nil { - return GalleryImageVersionResponse{}, err + return DedicatedHostsUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// GalleryPoller provides polling facilities until the operation reaches a terminal state. -type GalleryPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final GalleryResponse will be returned. - FinalResponse(ctx context.Context) (GalleryResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DedicatedHostsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type galleryPoller struct { - pt *armcore.LROPoller +// DiskAccessesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DiskAccessesCreateOrUpdatePoller struct { + pt *azcore.Poller } -func (p *galleryPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *DiskAccessesCreateOrUpdatePoller) Done() bool { return p.pt.Done() } -func (p *galleryPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiskAccessesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *galleryPoller) FinalResponse(ctx context.Context) (GalleryResponse, error) { - respType := GalleryResponse{Gallery: &Gallery{}} - resp, err := p.pt.FinalResponse(ctx, respType.Gallery) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiskAccessesCreateOrUpdateResponse will be returned. +func (p *DiskAccessesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (DiskAccessesCreateOrUpdateResponse, error) { + respType := DiskAccessesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.DiskAccess) if err != nil { - return GalleryResponse{}, err + return DiskAccessesCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *galleryPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiskAccessesCreateOrUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *galleryPoller) pollUntilDone(ctx context.Context, freq time.Duration) (GalleryResponse, error) { - respType := GalleryResponse{Gallery: &Gallery{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.Gallery) +// DiskAccessesDeleteAPrivateEndpointConnectionPoller provides polling facilities until the operation reaches a terminal state. +type DiskAccessesDeleteAPrivateEndpointConnectionPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DiskAccessesDeleteAPrivateEndpointConnectionPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiskAccessesDeleteAPrivateEndpointConnectionPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiskAccessesDeleteAPrivateEndpointConnectionResponse will be returned. +func (p *DiskAccessesDeleteAPrivateEndpointConnectionPoller) FinalResponse(ctx context.Context) (DiskAccessesDeleteAPrivateEndpointConnectionResponse, error) { + respType := DiskAccessesDeleteAPrivateEndpointConnectionResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return GalleryResponse{}, err + return DiskAccessesDeleteAPrivateEndpointConnectionResponse{}, err } respType.RawResponse = resp return respType, nil } -// HTTPPoller provides polling facilities until the operation reaches a terminal state. -type HTTPPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final *http.Response will be returned. - FinalResponse(ctx context.Context) (*http.Response, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiskAccessesDeleteAPrivateEndpointConnectionPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type httpPoller struct { - pt *armcore.LROPoller +// DiskAccessesDeletePoller provides polling facilities until the operation reaches a terminal state. +type DiskAccessesDeletePoller struct { + pt *azcore.Poller } -func (p *httpPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *DiskAccessesDeletePoller) Done() bool { return p.pt.Done() } -func (p *httpPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiskAccessesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *httpPoller) FinalResponse(ctx context.Context) (*http.Response, error) { - return p.pt.FinalResponse(ctx, nil) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiskAccessesDeleteResponse will be returned. +func (p *DiskAccessesDeletePoller) FinalResponse(ctx context.Context) (DiskAccessesDeleteResponse, error) { + respType := DiskAccessesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DiskAccessesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil } -func (p *httpPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiskAccessesDeletePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *httpPoller) pollUntilDone(ctx context.Context, freq time.Duration) (*http.Response, error) { - return p.pt.PollUntilDone(ctx, freq, nil) -} - -// ImagePoller provides polling facilities until the operation reaches a terminal state. -type ImagePoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final ImageResponse will be returned. - FinalResponse(ctx context.Context) (ImageResponse, error) -} - -type imagePoller struct { - pt *armcore.LROPoller +// DiskAccessesUpdateAPrivateEndpointConnectionPoller provides polling facilities until the operation reaches a terminal state. +type DiskAccessesUpdateAPrivateEndpointConnectionPoller struct { + pt *azcore.Poller } -func (p *imagePoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *DiskAccessesUpdateAPrivateEndpointConnectionPoller) Done() bool { return p.pt.Done() } -func (p *imagePoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiskAccessesUpdateAPrivateEndpointConnectionPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *imagePoller) FinalResponse(ctx context.Context) (ImageResponse, error) { - respType := ImageResponse{Image: &Image{}} - resp, err := p.pt.FinalResponse(ctx, respType.Image) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiskAccessesUpdateAPrivateEndpointConnectionResponse will be returned. +func (p *DiskAccessesUpdateAPrivateEndpointConnectionPoller) FinalResponse(ctx context.Context) (DiskAccessesUpdateAPrivateEndpointConnectionResponse, error) { + respType := DiskAccessesUpdateAPrivateEndpointConnectionResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.PrivateEndpointConnection) if err != nil { - return ImageResponse{}, err + return DiskAccessesUpdateAPrivateEndpointConnectionResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *imagePoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiskAccessesUpdateAPrivateEndpointConnectionPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *imagePoller) pollUntilDone(ctx context.Context, freq time.Duration) (ImageResponse, error) { - respType := ImageResponse{Image: &Image{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.Image) +// DiskAccessesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DiskAccessesUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DiskAccessesUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiskAccessesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiskAccessesUpdateResponse will be returned. +func (p *DiskAccessesUpdatePoller) FinalResponse(ctx context.Context) (DiskAccessesUpdateResponse, error) { + respType := DiskAccessesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.DiskAccess) if err != nil { - return ImageResponse{}, err + return DiskAccessesUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// LogAnalyticsOperationResultPoller provides polling facilities until the operation reaches a terminal state. -type LogAnalyticsOperationResultPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final LogAnalyticsOperationResultResponse will be returned. - FinalResponse(ctx context.Context) (LogAnalyticsOperationResultResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiskAccessesUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type logAnalyticsOperationResultPoller struct { - pt *armcore.LROPoller +// DiskEncryptionSetsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DiskEncryptionSetsCreateOrUpdatePoller struct { + pt *azcore.Poller } -func (p *logAnalyticsOperationResultPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *DiskEncryptionSetsCreateOrUpdatePoller) Done() bool { return p.pt.Done() } -func (p *logAnalyticsOperationResultPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiskEncryptionSetsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *logAnalyticsOperationResultPoller) FinalResponse(ctx context.Context) (LogAnalyticsOperationResultResponse, error) { - respType := LogAnalyticsOperationResultResponse{LogAnalyticsOperationResult: &LogAnalyticsOperationResult{}} - resp, err := p.pt.FinalResponse(ctx, respType.LogAnalyticsOperationResult) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiskEncryptionSetsCreateOrUpdateResponse will be returned. +func (p *DiskEncryptionSetsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (DiskEncryptionSetsCreateOrUpdateResponse, error) { + respType := DiskEncryptionSetsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.DiskEncryptionSet) if err != nil { - return LogAnalyticsOperationResultResponse{}, err + return DiskEncryptionSetsCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *logAnalyticsOperationResultPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiskEncryptionSetsCreateOrUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *logAnalyticsOperationResultPoller) pollUntilDone(ctx context.Context, freq time.Duration) (LogAnalyticsOperationResultResponse, error) { - respType := LogAnalyticsOperationResultResponse{LogAnalyticsOperationResult: &LogAnalyticsOperationResult{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.LogAnalyticsOperationResult) +// DiskEncryptionSetsDeletePoller provides polling facilities until the operation reaches a terminal state. +type DiskEncryptionSetsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DiskEncryptionSetsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiskEncryptionSetsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiskEncryptionSetsDeleteResponse will be returned. +func (p *DiskEncryptionSetsDeletePoller) FinalResponse(ctx context.Context) (DiskEncryptionSetsDeleteResponse, error) { + respType := DiskEncryptionSetsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return LogAnalyticsOperationResultResponse{}, err + return DiskEncryptionSetsDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -// PrivateEndpointConnectionPoller provides polling facilities until the operation reaches a terminal state. -type PrivateEndpointConnectionPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final PrivateEndpointConnectionResponse will be returned. - FinalResponse(ctx context.Context) (PrivateEndpointConnectionResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiskEncryptionSetsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type privateEndpointConnectionPoller struct { - pt *armcore.LROPoller +// DiskEncryptionSetsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DiskEncryptionSetsUpdatePoller struct { + pt *azcore.Poller } -func (p *privateEndpointConnectionPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *DiskEncryptionSetsUpdatePoller) Done() bool { return p.pt.Done() } -func (p *privateEndpointConnectionPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiskEncryptionSetsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *privateEndpointConnectionPoller) FinalResponse(ctx context.Context) (PrivateEndpointConnectionResponse, error) { - respType := PrivateEndpointConnectionResponse{PrivateEndpointConnection: &PrivateEndpointConnection{}} - resp, err := p.pt.FinalResponse(ctx, respType.PrivateEndpointConnection) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiskEncryptionSetsUpdateResponse will be returned. +func (p *DiskEncryptionSetsUpdatePoller) FinalResponse(ctx context.Context) (DiskEncryptionSetsUpdateResponse, error) { + respType := DiskEncryptionSetsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.DiskEncryptionSet) if err != nil { - return PrivateEndpointConnectionResponse{}, err + return DiskEncryptionSetsUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *privateEndpointConnectionPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiskEncryptionSetsUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *privateEndpointConnectionPoller) pollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionResponse, error) { - respType := PrivateEndpointConnectionResponse{PrivateEndpointConnection: &PrivateEndpointConnection{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.PrivateEndpointConnection) +// DiskRestorePointGrantAccessPoller provides polling facilities until the operation reaches a terminal state. +type DiskRestorePointGrantAccessPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DiskRestorePointGrantAccessPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiskRestorePointGrantAccessPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiskRestorePointGrantAccessResponse will be returned. +func (p *DiskRestorePointGrantAccessPoller) FinalResponse(ctx context.Context) (DiskRestorePointGrantAccessResponse, error) { + respType := DiskRestorePointGrantAccessResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.AccessURI) if err != nil { - return PrivateEndpointConnectionResponse{}, err + return DiskRestorePointGrantAccessResponse{}, err } respType.RawResponse = resp return respType, nil } -// RestorePointPoller provides polling facilities until the operation reaches a terminal state. -type RestorePointPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final RestorePointResponse will be returned. - FinalResponse(ctx context.Context) (RestorePointResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiskRestorePointGrantAccessPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type restorePointPoller struct { - pt *armcore.LROPoller +// DiskRestorePointRevokeAccessPoller provides polling facilities until the operation reaches a terminal state. +type DiskRestorePointRevokeAccessPoller struct { + pt *azcore.Poller } -func (p *restorePointPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *DiskRestorePointRevokeAccessPoller) Done() bool { return p.pt.Done() } -func (p *restorePointPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DiskRestorePointRevokeAccessPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *restorePointPoller) FinalResponse(ctx context.Context) (RestorePointResponse, error) { - respType := RestorePointResponse{RestorePoint: &RestorePoint{}} - resp, err := p.pt.FinalResponse(ctx, respType.RestorePoint) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DiskRestorePointRevokeAccessResponse will be returned. +func (p *DiskRestorePointRevokeAccessPoller) FinalResponse(ctx context.Context) (DiskRestorePointRevokeAccessResponse, error) { + respType := DiskRestorePointRevokeAccessResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return RestorePointResponse{}, err + return DiskRestorePointRevokeAccessResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *restorePointPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DiskRestorePointRevokeAccessPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *restorePointPoller) pollUntilDone(ctx context.Context, freq time.Duration) (RestorePointResponse, error) { - respType := RestorePointResponse{RestorePoint: &RestorePoint{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.RestorePoint) +// DisksCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DisksCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DisksCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DisksCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DisksCreateOrUpdateResponse will be returned. +func (p *DisksCreateOrUpdatePoller) FinalResponse(ctx context.Context) (DisksCreateOrUpdateResponse, error) { + respType := DisksCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Disk) if err != nil { - return RestorePointResponse{}, err + return DisksCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// RunCommandResultPoller provides polling facilities until the operation reaches a terminal state. -type RunCommandResultPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final RunCommandResultResponse will be returned. - FinalResponse(ctx context.Context) (RunCommandResultResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DisksCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type runCommandResultPoller struct { - pt *armcore.LROPoller +// DisksDeletePoller provides polling facilities until the operation reaches a terminal state. +type DisksDeletePoller struct { + pt *azcore.Poller } -func (p *runCommandResultPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *DisksDeletePoller) Done() bool { return p.pt.Done() } -func (p *runCommandResultPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DisksDeletePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *runCommandResultPoller) FinalResponse(ctx context.Context) (RunCommandResultResponse, error) { - respType := RunCommandResultResponse{RunCommandResult: &RunCommandResult{}} - resp, err := p.pt.FinalResponse(ctx, respType.RunCommandResult) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DisksDeleteResponse will be returned. +func (p *DisksDeletePoller) FinalResponse(ctx context.Context) (DisksDeleteResponse, error) { + respType := DisksDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return RunCommandResultResponse{}, err + return DisksDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *runCommandResultPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DisksDeletePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *runCommandResultPoller) pollUntilDone(ctx context.Context, freq time.Duration) (RunCommandResultResponse, error) { - respType := RunCommandResultResponse{RunCommandResult: &RunCommandResult{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.RunCommandResult) +// DisksGrantAccessPoller provides polling facilities until the operation reaches a terminal state. +type DisksGrantAccessPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DisksGrantAccessPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DisksGrantAccessPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DisksGrantAccessResponse will be returned. +func (p *DisksGrantAccessPoller) FinalResponse(ctx context.Context) (DisksGrantAccessResponse, error) { + respType := DisksGrantAccessResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.AccessURI) if err != nil { - return RunCommandResultResponse{}, err + return DisksGrantAccessResponse{}, err } respType.RawResponse = resp return respType, nil } -// SharingUpdatePoller provides polling facilities until the operation reaches a terminal state. -type SharingUpdatePoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final SharingUpdateResponse will be returned. - FinalResponse(ctx context.Context) (SharingUpdateResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DisksGrantAccessPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type sharingUpdatePoller struct { - pt *armcore.LROPoller +// DisksRevokeAccessPoller provides polling facilities until the operation reaches a terminal state. +type DisksRevokeAccessPoller struct { + pt *azcore.Poller } -func (p *sharingUpdatePoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *DisksRevokeAccessPoller) Done() bool { return p.pt.Done() } -func (p *sharingUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DisksRevokeAccessPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *sharingUpdatePoller) FinalResponse(ctx context.Context) (SharingUpdateResponse, error) { - respType := SharingUpdateResponse{SharingUpdate: &SharingUpdate{}} - resp, err := p.pt.FinalResponse(ctx, respType.SharingUpdate) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DisksRevokeAccessResponse will be returned. +func (p *DisksRevokeAccessPoller) FinalResponse(ctx context.Context) (DisksRevokeAccessResponse, error) { + respType := DisksRevokeAccessResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return SharingUpdateResponse{}, err + return DisksRevokeAccessResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *sharingUpdatePoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DisksRevokeAccessPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *sharingUpdatePoller) pollUntilDone(ctx context.Context, freq time.Duration) (SharingUpdateResponse, error) { - respType := SharingUpdateResponse{SharingUpdate: &SharingUpdate{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.SharingUpdate) +// DisksUpdatePoller provides polling facilities until the operation reaches a terminal state. +type DisksUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DisksUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DisksUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DisksUpdateResponse will be returned. +func (p *DisksUpdatePoller) FinalResponse(ctx context.Context) (DisksUpdateResponse, error) { + respType := DisksUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Disk) if err != nil { - return SharingUpdateResponse{}, err + return DisksUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// SnapshotPoller provides polling facilities until the operation reaches a terminal state. -type SnapshotPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final SnapshotResponse will be returned. - FinalResponse(ctx context.Context) (SnapshotResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DisksUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type snapshotPoller struct { - pt *armcore.LROPoller +// GalleriesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GalleriesCreateOrUpdatePoller struct { + pt *azcore.Poller } -func (p *snapshotPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *GalleriesCreateOrUpdatePoller) Done() bool { return p.pt.Done() } -func (p *snapshotPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleriesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *snapshotPoller) FinalResponse(ctx context.Context) (SnapshotResponse, error) { - respType := SnapshotResponse{Snapshot: &Snapshot{}} - resp, err := p.pt.FinalResponse(ctx, respType.Snapshot) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleriesCreateOrUpdateResponse will be returned. +func (p *GalleriesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (GalleriesCreateOrUpdateResponse, error) { + respType := GalleriesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Gallery) if err != nil { - return SnapshotResponse{}, err + return GalleriesCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *snapshotPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleriesCreateOrUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *snapshotPoller) pollUntilDone(ctx context.Context, freq time.Duration) (SnapshotResponse, error) { - respType := SnapshotResponse{Snapshot: &Snapshot{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.Snapshot) +// GalleriesDeletePoller provides polling facilities until the operation reaches a terminal state. +type GalleriesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *GalleriesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleriesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleriesDeleteResponse will be returned. +func (p *GalleriesDeletePoller) FinalResponse(ctx context.Context) (GalleriesDeleteResponse, error) { + respType := GalleriesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return SnapshotResponse{}, err + return GalleriesDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -// VirtualMachineAssessPatchesResultPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineAssessPatchesResultPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final VirtualMachineAssessPatchesResultResponse will be returned. - FinalResponse(ctx context.Context) (VirtualMachineAssessPatchesResultResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleriesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type virtualMachineAssessPatchesResultPoller struct { - pt *armcore.LROPoller +// GalleriesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GalleriesUpdatePoller struct { + pt *azcore.Poller } -func (p *virtualMachineAssessPatchesResultPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *GalleriesUpdatePoller) Done() bool { return p.pt.Done() } -func (p *virtualMachineAssessPatchesResultPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleriesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *virtualMachineAssessPatchesResultPoller) FinalResponse(ctx context.Context) (VirtualMachineAssessPatchesResultResponse, error) { - respType := VirtualMachineAssessPatchesResultResponse{VirtualMachineAssessPatchesResult: &VirtualMachineAssessPatchesResult{}} - resp, err := p.pt.FinalResponse(ctx, respType.VirtualMachineAssessPatchesResult) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleriesUpdateResponse will be returned. +func (p *GalleriesUpdatePoller) FinalResponse(ctx context.Context) (GalleriesUpdateResponse, error) { + respType := GalleriesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Gallery) if err != nil { - return VirtualMachineAssessPatchesResultResponse{}, err + return GalleriesUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *virtualMachineAssessPatchesResultPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleriesUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *virtualMachineAssessPatchesResultPoller) pollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineAssessPatchesResultResponse, error) { - respType := VirtualMachineAssessPatchesResultResponse{VirtualMachineAssessPatchesResult: &VirtualMachineAssessPatchesResult{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.VirtualMachineAssessPatchesResult) +// GalleryApplicationVersionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GalleryApplicationVersionsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryApplicationVersionsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryApplicationVersionsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryApplicationVersionsCreateOrUpdateResponse will be returned. +func (p *GalleryApplicationVersionsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (GalleryApplicationVersionsCreateOrUpdateResponse, error) { + respType := GalleryApplicationVersionsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.GalleryApplicationVersion) if err != nil { - return VirtualMachineAssessPatchesResultResponse{}, err + return GalleryApplicationVersionsCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// VirtualMachineCaptureResultPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineCaptureResultPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final VirtualMachineCaptureResultResponse will be returned. - FinalResponse(ctx context.Context) (VirtualMachineCaptureResultResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryApplicationVersionsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type virtualMachineCaptureResultPoller struct { - pt *armcore.LROPoller +// GalleryApplicationVersionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type GalleryApplicationVersionsDeletePoller struct { + pt *azcore.Poller } -func (p *virtualMachineCaptureResultPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryApplicationVersionsDeletePoller) Done() bool { return p.pt.Done() } -func (p *virtualMachineCaptureResultPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryApplicationVersionsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *virtualMachineCaptureResultPoller) FinalResponse(ctx context.Context) (VirtualMachineCaptureResultResponse, error) { - respType := VirtualMachineCaptureResultResponse{VirtualMachineCaptureResult: &VirtualMachineCaptureResult{}} - resp, err := p.pt.FinalResponse(ctx, respType.VirtualMachineCaptureResult) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryApplicationVersionsDeleteResponse will be returned. +func (p *GalleryApplicationVersionsDeletePoller) FinalResponse(ctx context.Context) (GalleryApplicationVersionsDeleteResponse, error) { + respType := GalleryApplicationVersionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return VirtualMachineCaptureResultResponse{}, err + return GalleryApplicationVersionsDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *virtualMachineCaptureResultPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryApplicationVersionsDeletePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *virtualMachineCaptureResultPoller) pollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineCaptureResultResponse, error) { - respType := VirtualMachineCaptureResultResponse{VirtualMachineCaptureResult: &VirtualMachineCaptureResult{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.VirtualMachineCaptureResult) +// GalleryApplicationVersionsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GalleryApplicationVersionsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryApplicationVersionsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryApplicationVersionsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryApplicationVersionsUpdateResponse will be returned. +func (p *GalleryApplicationVersionsUpdatePoller) FinalResponse(ctx context.Context) (GalleryApplicationVersionsUpdateResponse, error) { + respType := GalleryApplicationVersionsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.GalleryApplicationVersion) if err != nil { - return VirtualMachineCaptureResultResponse{}, err + return GalleryApplicationVersionsUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// VirtualMachineExtensionPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineExtensionPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final VirtualMachineExtensionResponse will be returned. - FinalResponse(ctx context.Context) (VirtualMachineExtensionResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryApplicationVersionsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type virtualMachineExtensionPoller struct { - pt *armcore.LROPoller +// GalleryApplicationsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GalleryApplicationsCreateOrUpdatePoller struct { + pt *azcore.Poller } -func (p *virtualMachineExtensionPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryApplicationsCreateOrUpdatePoller) Done() bool { return p.pt.Done() } -func (p *virtualMachineExtensionPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryApplicationsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *virtualMachineExtensionPoller) FinalResponse(ctx context.Context) (VirtualMachineExtensionResponse, error) { - respType := VirtualMachineExtensionResponse{VirtualMachineExtension: &VirtualMachineExtension{}} - resp, err := p.pt.FinalResponse(ctx, respType.VirtualMachineExtension) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryApplicationsCreateOrUpdateResponse will be returned. +func (p *GalleryApplicationsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (GalleryApplicationsCreateOrUpdateResponse, error) { + respType := GalleryApplicationsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.GalleryApplication) if err != nil { - return VirtualMachineExtensionResponse{}, err + return GalleryApplicationsCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *virtualMachineExtensionPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryApplicationsCreateOrUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *virtualMachineExtensionPoller) pollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineExtensionResponse, error) { - respType := VirtualMachineExtensionResponse{VirtualMachineExtension: &VirtualMachineExtension{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.VirtualMachineExtension) +// GalleryApplicationsDeletePoller provides polling facilities until the operation reaches a terminal state. +type GalleryApplicationsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryApplicationsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryApplicationsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryApplicationsDeleteResponse will be returned. +func (p *GalleryApplicationsDeletePoller) FinalResponse(ctx context.Context) (GalleryApplicationsDeleteResponse, error) { + respType := GalleryApplicationsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return VirtualMachineExtensionResponse{}, err + return GalleryApplicationsDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -// VirtualMachineInstallPatchesResultPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineInstallPatchesResultPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final VirtualMachineInstallPatchesResultResponse will be returned. - FinalResponse(ctx context.Context) (VirtualMachineInstallPatchesResultResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryApplicationsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type virtualMachineInstallPatchesResultPoller struct { - pt *armcore.LROPoller +// GalleryApplicationsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GalleryApplicationsUpdatePoller struct { + pt *azcore.Poller } -func (p *virtualMachineInstallPatchesResultPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryApplicationsUpdatePoller) Done() bool { return p.pt.Done() } -func (p *virtualMachineInstallPatchesResultPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryApplicationsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *virtualMachineInstallPatchesResultPoller) FinalResponse(ctx context.Context) (VirtualMachineInstallPatchesResultResponse, error) { - respType := VirtualMachineInstallPatchesResultResponse{VirtualMachineInstallPatchesResult: &VirtualMachineInstallPatchesResult{}} - resp, err := p.pt.FinalResponse(ctx, respType.VirtualMachineInstallPatchesResult) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryApplicationsUpdateResponse will be returned. +func (p *GalleryApplicationsUpdatePoller) FinalResponse(ctx context.Context) (GalleryApplicationsUpdateResponse, error) { + respType := GalleryApplicationsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.GalleryApplication) if err != nil { - return VirtualMachineInstallPatchesResultResponse{}, err + return GalleryApplicationsUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *virtualMachineInstallPatchesResultPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryApplicationsUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *virtualMachineInstallPatchesResultPoller) pollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineInstallPatchesResultResponse, error) { - respType := VirtualMachineInstallPatchesResultResponse{VirtualMachineInstallPatchesResult: &VirtualMachineInstallPatchesResult{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.VirtualMachineInstallPatchesResult) +// GalleryImageVersionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GalleryImageVersionsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryImageVersionsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryImageVersionsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryImageVersionsCreateOrUpdateResponse will be returned. +func (p *GalleryImageVersionsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (GalleryImageVersionsCreateOrUpdateResponse, error) { + respType := GalleryImageVersionsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.GalleryImageVersion) if err != nil { - return VirtualMachineInstallPatchesResultResponse{}, err + return GalleryImageVersionsCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// VirtualMachinePoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachinePoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final VirtualMachineResponse will be returned. - FinalResponse(ctx context.Context) (VirtualMachineResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryImageVersionsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type virtualMachinePoller struct { - pt *armcore.LROPoller +// GalleryImageVersionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type GalleryImageVersionsDeletePoller struct { + pt *azcore.Poller } -func (p *virtualMachinePoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryImageVersionsDeletePoller) Done() bool { return p.pt.Done() } -func (p *virtualMachinePoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryImageVersionsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *virtualMachinePoller) FinalResponse(ctx context.Context) (VirtualMachineResponse, error) { - respType := VirtualMachineResponse{VirtualMachine: &VirtualMachine{}} - resp, err := p.pt.FinalResponse(ctx, respType.VirtualMachine) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryImageVersionsDeleteResponse will be returned. +func (p *GalleryImageVersionsDeletePoller) FinalResponse(ctx context.Context) (GalleryImageVersionsDeleteResponse, error) { + respType := GalleryImageVersionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return VirtualMachineResponse{}, err + return GalleryImageVersionsDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *virtualMachinePoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryImageVersionsDeletePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *virtualMachinePoller) pollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineResponse, error) { - respType := VirtualMachineResponse{VirtualMachine: &VirtualMachine{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.VirtualMachine) +// GalleryImageVersionsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GalleryImageVersionsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryImageVersionsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryImageVersionsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryImageVersionsUpdateResponse will be returned. +func (p *GalleryImageVersionsUpdatePoller) FinalResponse(ctx context.Context) (GalleryImageVersionsUpdateResponse, error) { + respType := GalleryImageVersionsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.GalleryImageVersion) if err != nil { - return VirtualMachineResponse{}, err + return GalleryImageVersionsUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// VirtualMachineRunCommandPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineRunCommandPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final VirtualMachineRunCommandResponse will be returned. - FinalResponse(ctx context.Context) (VirtualMachineRunCommandResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryImageVersionsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type virtualMachineRunCommandPoller struct { - pt *armcore.LROPoller +// GalleryImagesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GalleryImagesCreateOrUpdatePoller struct { + pt *azcore.Poller } -func (p *virtualMachineRunCommandPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryImagesCreateOrUpdatePoller) Done() bool { return p.pt.Done() } -func (p *virtualMachineRunCommandPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryImagesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *virtualMachineRunCommandPoller) FinalResponse(ctx context.Context) (VirtualMachineRunCommandResponse, error) { - respType := VirtualMachineRunCommandResponse{VirtualMachineRunCommand: &VirtualMachineRunCommand{}} - resp, err := p.pt.FinalResponse(ctx, respType.VirtualMachineRunCommand) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryImagesCreateOrUpdateResponse will be returned. +func (p *GalleryImagesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (GalleryImagesCreateOrUpdateResponse, error) { + respType := GalleryImagesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.GalleryImage) if err != nil { - return VirtualMachineRunCommandResponse{}, err + return GalleryImagesCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *virtualMachineRunCommandPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryImagesCreateOrUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *virtualMachineRunCommandPoller) pollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineRunCommandResponse, error) { - respType := VirtualMachineRunCommandResponse{VirtualMachineRunCommand: &VirtualMachineRunCommand{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.VirtualMachineRunCommand) +// GalleryImagesDeletePoller provides polling facilities until the operation reaches a terminal state. +type GalleryImagesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryImagesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryImagesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryImagesDeleteResponse will be returned. +func (p *GalleryImagesDeletePoller) FinalResponse(ctx context.Context) (GalleryImagesDeleteResponse, error) { + respType := GalleryImagesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return VirtualMachineRunCommandResponse{}, err + return GalleryImagesDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -// VirtualMachineScaleSetExtensionPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineScaleSetExtensionPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final VirtualMachineScaleSetExtensionResponse will be returned. - FinalResponse(ctx context.Context) (VirtualMachineScaleSetExtensionResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryImagesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type virtualMachineScaleSetExtensionPoller struct { - pt *armcore.LROPoller +// GalleryImagesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GalleryImagesUpdatePoller struct { + pt *azcore.Poller } -func (p *virtualMachineScaleSetExtensionPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *GalleryImagesUpdatePoller) Done() bool { return p.pt.Done() } -func (p *virtualMachineScaleSetExtensionPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GalleryImagesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *virtualMachineScaleSetExtensionPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetExtensionResponse, error) { - respType := VirtualMachineScaleSetExtensionResponse{VirtualMachineScaleSetExtension: &VirtualMachineScaleSetExtension{}} - resp, err := p.pt.FinalResponse(ctx, respType.VirtualMachineScaleSetExtension) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GalleryImagesUpdateResponse will be returned. +func (p *GalleryImagesUpdatePoller) FinalResponse(ctx context.Context) (GalleryImagesUpdateResponse, error) { + respType := GalleryImagesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.GalleryImage) if err != nil { - return VirtualMachineScaleSetExtensionResponse{}, err + return GalleryImagesUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *virtualMachineScaleSetExtensionPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GalleryImagesUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *virtualMachineScaleSetExtensionPoller) pollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetExtensionResponse, error) { - respType := VirtualMachineScaleSetExtensionResponse{VirtualMachineScaleSetExtension: &VirtualMachineScaleSetExtension{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.VirtualMachineScaleSetExtension) +// GallerySharingProfileUpdatePoller provides polling facilities until the operation reaches a terminal state. +type GallerySharingProfileUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *GallerySharingProfileUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *GallerySharingProfileUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final GallerySharingProfileUpdateResponse will be returned. +func (p *GallerySharingProfileUpdatePoller) FinalResponse(ctx context.Context) (GallerySharingProfileUpdateResponse, error) { + respType := GallerySharingProfileUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.SharingUpdate) if err != nil { - return VirtualMachineScaleSetExtensionResponse{}, err + return GallerySharingProfileUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -// VirtualMachineScaleSetPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineScaleSetPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final VirtualMachineScaleSetResponse will be returned. - FinalResponse(ctx context.Context) (VirtualMachineScaleSetResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *GallerySharingProfileUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type virtualMachineScaleSetPoller struct { - pt *armcore.LROPoller +// ImagesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type ImagesCreateOrUpdatePoller struct { + pt *azcore.Poller } -func (p *virtualMachineScaleSetPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *ImagesCreateOrUpdatePoller) Done() bool { return p.pt.Done() } -func (p *virtualMachineScaleSetPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ImagesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *virtualMachineScaleSetPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetResponse, error) { - respType := VirtualMachineScaleSetResponse{VirtualMachineScaleSet: &VirtualMachineScaleSet{}} - resp, err := p.pt.FinalResponse(ctx, respType.VirtualMachineScaleSet) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ImagesCreateOrUpdateResponse will be returned. +func (p *ImagesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (ImagesCreateOrUpdateResponse, error) { + respType := ImagesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Image) if err != nil { - return VirtualMachineScaleSetResponse{}, err + return ImagesCreateOrUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *virtualMachineScaleSetPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ImagesCreateOrUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *virtualMachineScaleSetPoller) pollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetResponse, error) { - respType := VirtualMachineScaleSetResponse{VirtualMachineScaleSet: &VirtualMachineScaleSet{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.VirtualMachineScaleSet) +// ImagesDeletePoller provides polling facilities until the operation reaches a terminal state. +type ImagesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ImagesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ImagesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ImagesDeleteResponse will be returned. +func (p *ImagesDeletePoller) FinalResponse(ctx context.Context) (ImagesDeleteResponse, error) { + respType := ImagesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return VirtualMachineScaleSetResponse{}, err + return ImagesDeleteResponse{}, err } respType.RawResponse = resp return respType, nil } -// VirtualMachineScaleSetVMExtensionPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineScaleSetVMExtensionPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final VirtualMachineScaleSetVMExtensionResponse will be returned. - FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMExtensionResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ImagesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type virtualMachineScaleSetVMExtensionPoller struct { - pt *armcore.LROPoller +// ImagesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type ImagesUpdatePoller struct { + pt *azcore.Poller } -func (p *virtualMachineScaleSetVMExtensionPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *ImagesUpdatePoller) Done() bool { return p.pt.Done() } -func (p *virtualMachineScaleSetVMExtensionPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ImagesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *virtualMachineScaleSetVMExtensionPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMExtensionResponse, error) { - respType := VirtualMachineScaleSetVMExtensionResponse{VirtualMachineScaleSetVMExtension: &VirtualMachineScaleSetVMExtension{}} - resp, err := p.pt.FinalResponse(ctx, respType.VirtualMachineScaleSetVMExtension) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ImagesUpdateResponse will be returned. +func (p *ImagesUpdatePoller) FinalResponse(ctx context.Context) (ImagesUpdateResponse, error) { + respType := ImagesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Image) if err != nil { - return VirtualMachineScaleSetVMExtensionResponse{}, err + return ImagesUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *virtualMachineScaleSetVMExtensionPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ImagesUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *virtualMachineScaleSetVMExtensionPoller) pollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMExtensionResponse, error) { - respType := VirtualMachineScaleSetVMExtensionResponse{VirtualMachineScaleSetVMExtension: &VirtualMachineScaleSetVMExtension{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.VirtualMachineScaleSetVMExtension) +// LogAnalyticsExportRequestRateByIntervalPoller provides polling facilities until the operation reaches a terminal state. +type LogAnalyticsExportRequestRateByIntervalPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LogAnalyticsExportRequestRateByIntervalPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LogAnalyticsExportRequestRateByIntervalPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LogAnalyticsExportRequestRateByIntervalResponse will be returned. +func (p *LogAnalyticsExportRequestRateByIntervalPoller) FinalResponse(ctx context.Context) (LogAnalyticsExportRequestRateByIntervalResponse, error) { + respType := LogAnalyticsExportRequestRateByIntervalResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.LogAnalyticsOperationResult) if err != nil { - return VirtualMachineScaleSetVMExtensionResponse{}, err + return LogAnalyticsExportRequestRateByIntervalResponse{}, err } respType.RawResponse = resp return respType, nil } -// VirtualMachineScaleSetVMPoller provides polling facilities until the operation reaches a terminal state. -type VirtualMachineScaleSetVMPoller interface { - azcore.Poller - // FinalResponse performs a final GET to the service and returns the final response - // for the polling operation. If there is an error performing the final GET then an error is returned. - // If the final GET succeeded then the final VirtualMachineScaleSetVMResponse will be returned. - FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMResponse, error) +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LogAnalyticsExportRequestRateByIntervalPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() } -type virtualMachineScaleSetVMPoller struct { - pt *armcore.LROPoller +// LogAnalyticsExportThrottledRequestsPoller provides polling facilities until the operation reaches a terminal state. +type LogAnalyticsExportThrottledRequestsPoller struct { + pt *azcore.Poller } -func (p *virtualMachineScaleSetVMPoller) Done() bool { +// Done returns true if the LRO has reached a terminal state. +func (p *LogAnalyticsExportThrottledRequestsPoller) Done() bool { return p.pt.Done() } -func (p *virtualMachineScaleSetVMPoller) Poll(ctx context.Context) (*http.Response, error) { +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LogAnalyticsExportThrottledRequestsPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } -func (p *virtualMachineScaleSetVMPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMResponse, error) { - respType := VirtualMachineScaleSetVMResponse{VirtualMachineScaleSetVM: &VirtualMachineScaleSetVM{}} - resp, err := p.pt.FinalResponse(ctx, respType.VirtualMachineScaleSetVM) +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LogAnalyticsExportThrottledRequestsResponse will be returned. +func (p *LogAnalyticsExportThrottledRequestsPoller) FinalResponse(ctx context.Context) (LogAnalyticsExportThrottledRequestsResponse, error) { + respType := LogAnalyticsExportThrottledRequestsResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.LogAnalyticsOperationResult) if err != nil { - return VirtualMachineScaleSetVMResponse{}, err + return LogAnalyticsExportThrottledRequestsResponse{}, err } respType.RawResponse = resp return respType, nil } -func (p *virtualMachineScaleSetVMPoller) ResumeToken() (string, error) { +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LogAnalyticsExportThrottledRequestsPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -func (p *virtualMachineScaleSetVMPoller) pollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMResponse, error) { - respType := VirtualMachineScaleSetVMResponse{VirtualMachineScaleSetVM: &VirtualMachineScaleSetVM{}} - resp, err := p.pt.PollUntilDone(ctx, freq, respType.VirtualMachineScaleSetVM) +// RestorePointCollectionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type RestorePointCollectionsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *RestorePointCollectionsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *RestorePointCollectionsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final RestorePointCollectionsDeleteResponse will be returned. +func (p *RestorePointCollectionsDeletePoller) FinalResponse(ctx context.Context) (RestorePointCollectionsDeleteResponse, error) { + respType := RestorePointCollectionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return RestorePointCollectionsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *RestorePointCollectionsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// RestorePointsCreatePoller provides polling facilities until the operation reaches a terminal state. +type RestorePointsCreatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *RestorePointsCreatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *RestorePointsCreatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final RestorePointsCreateResponse will be returned. +func (p *RestorePointsCreatePoller) FinalResponse(ctx context.Context) (RestorePointsCreateResponse, error) { + respType := RestorePointsCreateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.RestorePoint) + if err != nil { + return RestorePointsCreateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *RestorePointsCreatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// RestorePointsDeletePoller provides polling facilities until the operation reaches a terminal state. +type RestorePointsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *RestorePointsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *RestorePointsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final RestorePointsDeleteResponse will be returned. +func (p *RestorePointsDeletePoller) FinalResponse(ctx context.Context) (RestorePointsDeleteResponse, error) { + respType := RestorePointsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return RestorePointsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *RestorePointsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SnapshotsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type SnapshotsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SnapshotsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SnapshotsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SnapshotsCreateOrUpdateResponse will be returned. +func (p *SnapshotsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (SnapshotsCreateOrUpdateResponse, error) { + respType := SnapshotsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Snapshot) + if err != nil { + return SnapshotsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SnapshotsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SnapshotsDeletePoller provides polling facilities until the operation reaches a terminal state. +type SnapshotsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SnapshotsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SnapshotsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SnapshotsDeleteResponse will be returned. +func (p *SnapshotsDeletePoller) FinalResponse(ctx context.Context) (SnapshotsDeleteResponse, error) { + respType := SnapshotsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SnapshotsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SnapshotsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SnapshotsGrantAccessPoller provides polling facilities until the operation reaches a terminal state. +type SnapshotsGrantAccessPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SnapshotsGrantAccessPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SnapshotsGrantAccessPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SnapshotsGrantAccessResponse will be returned. +func (p *SnapshotsGrantAccessPoller) FinalResponse(ctx context.Context) (SnapshotsGrantAccessResponse, error) { + respType := SnapshotsGrantAccessResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.AccessURI) + if err != nil { + return SnapshotsGrantAccessResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SnapshotsGrantAccessPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SnapshotsRevokeAccessPoller provides polling facilities until the operation reaches a terminal state. +type SnapshotsRevokeAccessPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SnapshotsRevokeAccessPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SnapshotsRevokeAccessPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SnapshotsRevokeAccessResponse will be returned. +func (p *SnapshotsRevokeAccessPoller) FinalResponse(ctx context.Context) (SnapshotsRevokeAccessResponse, error) { + respType := SnapshotsRevokeAccessResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return SnapshotsRevokeAccessResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SnapshotsRevokeAccessPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// SnapshotsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type SnapshotsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *SnapshotsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *SnapshotsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final SnapshotsUpdateResponse will be returned. +func (p *SnapshotsUpdatePoller) FinalResponse(ctx context.Context) (SnapshotsUpdateResponse, error) { + respType := SnapshotsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.Snapshot) + if err != nil { + return SnapshotsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *SnapshotsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineExtensionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineExtensionsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineExtensionsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineExtensionsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineExtensionsCreateOrUpdateResponse will be returned. +func (p *VirtualMachineExtensionsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineExtensionsCreateOrUpdateResponse, error) { + respType := VirtualMachineExtensionsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineExtension) + if err != nil { + return VirtualMachineExtensionsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineExtensionsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineExtensionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineExtensionsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineExtensionsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineExtensionsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineExtensionsDeleteResponse will be returned. +func (p *VirtualMachineExtensionsDeletePoller) FinalResponse(ctx context.Context) (VirtualMachineExtensionsDeleteResponse, error) { + respType := VirtualMachineExtensionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineExtensionsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineExtensionsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineExtensionsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineExtensionsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineExtensionsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineExtensionsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineExtensionsUpdateResponse will be returned. +func (p *VirtualMachineExtensionsUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineExtensionsUpdateResponse, error) { + respType := VirtualMachineExtensionsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineExtension) + if err != nil { + return VirtualMachineExtensionsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineExtensionsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineRunCommandsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineRunCommandsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineRunCommandsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineRunCommandsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineRunCommandsCreateOrUpdateResponse will be returned. +func (p *VirtualMachineRunCommandsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineRunCommandsCreateOrUpdateResponse, error) { + respType := VirtualMachineRunCommandsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineRunCommand) + if err != nil { + return VirtualMachineRunCommandsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineRunCommandsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineRunCommandsDeletePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineRunCommandsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineRunCommandsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineRunCommandsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineRunCommandsDeleteResponse will be returned. +func (p *VirtualMachineRunCommandsDeletePoller) FinalResponse(ctx context.Context) (VirtualMachineRunCommandsDeleteResponse, error) { + respType := VirtualMachineRunCommandsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineRunCommandsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineRunCommandsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineRunCommandsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineRunCommandsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineRunCommandsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineRunCommandsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineRunCommandsUpdateResponse will be returned. +func (p *VirtualMachineRunCommandsUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineRunCommandsUpdateResponse, error) { + respType := VirtualMachineRunCommandsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineRunCommand) + if err != nil { + return VirtualMachineRunCommandsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineRunCommandsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetExtensionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetExtensionsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetExtensionsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetExtensionsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetExtensionsCreateOrUpdateResponse will be returned. +func (p *VirtualMachineScaleSetExtensionsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetExtensionsCreateOrUpdateResponse, error) { + respType := VirtualMachineScaleSetExtensionsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineScaleSetExtension) + if err != nil { + return VirtualMachineScaleSetExtensionsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetExtensionsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetExtensionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetExtensionsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetExtensionsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetExtensionsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetExtensionsDeleteResponse will be returned. +func (p *VirtualMachineScaleSetExtensionsDeletePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetExtensionsDeleteResponse, error) { + respType := VirtualMachineScaleSetExtensionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetExtensionsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetExtensionsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetExtensionsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetExtensionsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetExtensionsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetExtensionsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetExtensionsUpdateResponse will be returned. +func (p *VirtualMachineScaleSetExtensionsUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetExtensionsUpdateResponse, error) { + respType := VirtualMachineScaleSetExtensionsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineScaleSetExtension) + if err != nil { + return VirtualMachineScaleSetExtensionsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetExtensionsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetRollingUpgradesCancelPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetRollingUpgradesCancelPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetRollingUpgradesCancelPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetRollingUpgradesCancelPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetRollingUpgradesCancelResponse will be returned. +func (p *VirtualMachineScaleSetRollingUpgradesCancelPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetRollingUpgradesCancelResponse, error) { + respType := VirtualMachineScaleSetRollingUpgradesCancelResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetRollingUpgradesCancelResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetRollingUpgradesCancelPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeResponse will be returned. +func (p *VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeResponse, error) { + respType := VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetRollingUpgradesStartOSUpgradePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetRollingUpgradesStartOSUpgradePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetRollingUpgradesStartOSUpgradePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetRollingUpgradesStartOSUpgradePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetRollingUpgradesStartOSUpgradeResponse will be returned. +func (p *VirtualMachineScaleSetRollingUpgradesStartOSUpgradePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetRollingUpgradesStartOSUpgradeResponse, error) { + respType := VirtualMachineScaleSetRollingUpgradesStartOSUpgradeResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetRollingUpgradesStartOSUpgradeResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetRollingUpgradesStartOSUpgradePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMExtensionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMExtensionsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMExtensionsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMExtensionsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMExtensionsCreateOrUpdateResponse will be returned. +func (p *VirtualMachineScaleSetVMExtensionsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMExtensionsCreateOrUpdateResponse, error) { + respType := VirtualMachineScaleSetVMExtensionsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineScaleSetVMExtension) + if err != nil { + return VirtualMachineScaleSetVMExtensionsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMExtensionsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMExtensionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMExtensionsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMExtensionsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMExtensionsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMExtensionsDeleteResponse will be returned. +func (p *VirtualMachineScaleSetVMExtensionsDeletePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMExtensionsDeleteResponse, error) { + respType := VirtualMachineScaleSetVMExtensionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMExtensionsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMExtensionsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMExtensionsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMExtensionsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMExtensionsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMExtensionsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMExtensionsUpdateResponse will be returned. +func (p *VirtualMachineScaleSetVMExtensionsUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMExtensionsUpdateResponse, error) { + respType := VirtualMachineScaleSetVMExtensionsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineScaleSetVMExtension) + if err != nil { + return VirtualMachineScaleSetVMExtensionsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMExtensionsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResponse will be returned. +func (p *VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResponse, error) { + respType := VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineRunCommand) + if err != nil { + return VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMRunCommandsDeletePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMRunCommandsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMRunCommandsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMRunCommandsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMRunCommandsDeleteResponse will be returned. +func (p *VirtualMachineScaleSetVMRunCommandsDeletePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMRunCommandsDeleteResponse, error) { + respType := VirtualMachineScaleSetVMRunCommandsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMRunCommandsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMRunCommandsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMRunCommandsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMRunCommandsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMRunCommandsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMRunCommandsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMRunCommandsUpdateResponse will be returned. +func (p *VirtualMachineScaleSetVMRunCommandsUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMRunCommandsUpdateResponse, error) { + respType := VirtualMachineScaleSetVMRunCommandsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineRunCommand) + if err != nil { + return VirtualMachineScaleSetVMRunCommandsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMRunCommandsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsDeallocatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsDeallocatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsDeallocatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsDeallocatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsDeallocateResponse will be returned. +func (p *VirtualMachineScaleSetVMsDeallocatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsDeallocateResponse, error) { + respType := VirtualMachineScaleSetVMsDeallocateResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMsDeallocateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsDeallocatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsDeletePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsDeleteResponse will be returned. +func (p *VirtualMachineScaleSetVMsDeletePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsDeleteResponse, error) { + respType := VirtualMachineScaleSetVMsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsPerformMaintenancePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsPerformMaintenancePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsPerformMaintenancePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsPerformMaintenancePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsPerformMaintenanceResponse will be returned. +func (p *VirtualMachineScaleSetVMsPerformMaintenancePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsPerformMaintenanceResponse, error) { + respType := VirtualMachineScaleSetVMsPerformMaintenanceResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMsPerformMaintenanceResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsPerformMaintenancePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsPowerOffPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsPowerOffPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsPowerOffPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsPowerOffPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsPowerOffResponse will be returned. +func (p *VirtualMachineScaleSetVMsPowerOffPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsPowerOffResponse, error) { + respType := VirtualMachineScaleSetVMsPowerOffResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMsPowerOffResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsPowerOffPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsRedeployPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsRedeployPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsRedeployPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsRedeployPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsRedeployResponse will be returned. +func (p *VirtualMachineScaleSetVMsRedeployPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsRedeployResponse, error) { + respType := VirtualMachineScaleSetVMsRedeployResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMsRedeployResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsRedeployPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsReimageAllPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsReimageAllPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsReimageAllPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsReimageAllPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsReimageAllResponse will be returned. +func (p *VirtualMachineScaleSetVMsReimageAllPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsReimageAllResponse, error) { + respType := VirtualMachineScaleSetVMsReimageAllResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMsReimageAllResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsReimageAllPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsReimagePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsReimagePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsReimagePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsReimagePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsReimageResponse will be returned. +func (p *VirtualMachineScaleSetVMsReimagePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsReimageResponse, error) { + respType := VirtualMachineScaleSetVMsReimageResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMsReimageResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsReimagePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsRestartPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsRestartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsRestartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsRestartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsRestartResponse will be returned. +func (p *VirtualMachineScaleSetVMsRestartPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsRestartResponse, error) { + respType := VirtualMachineScaleSetVMsRestartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMsRestartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsRestartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsRunCommandPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsRunCommandPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsRunCommandPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsRunCommandPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsRunCommandResponse will be returned. +func (p *VirtualMachineScaleSetVMsRunCommandPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsRunCommandResponse, error) { + respType := VirtualMachineScaleSetVMsRunCommandResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.RunCommandResult) + if err != nil { + return VirtualMachineScaleSetVMsRunCommandResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsRunCommandPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsStartPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsStartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsStartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsStartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsStartResponse will be returned. +func (p *VirtualMachineScaleSetVMsStartPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsStartResponse, error) { + respType := VirtualMachineScaleSetVMsStartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetVMsStartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsStartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetVMsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetVMsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetVMsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetVMsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetVMsUpdateResponse will be returned. +func (p *VirtualMachineScaleSetVMsUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetVMsUpdateResponse, error) { + respType := VirtualMachineScaleSetVMsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineScaleSetVM) + if err != nil { + return VirtualMachineScaleSetVMsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetVMsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsCreateOrUpdateResponse will be returned. +func (p *VirtualMachineScaleSetsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsCreateOrUpdateResponse, error) { + respType := VirtualMachineScaleSetsCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineScaleSet) + if err != nil { + return VirtualMachineScaleSetsCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsDeallocatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsDeallocatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsDeallocatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsDeallocatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsDeallocateResponse will be returned. +func (p *VirtualMachineScaleSetsDeallocatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsDeallocateResponse, error) { + respType := VirtualMachineScaleSetsDeallocateResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsDeallocateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsDeallocatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsDeleteInstancesPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsDeleteInstancesPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsDeleteInstancesPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsDeleteInstancesPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsDeleteInstancesResponse will be returned. +func (p *VirtualMachineScaleSetsDeleteInstancesPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsDeleteInstancesResponse, error) { + respType := VirtualMachineScaleSetsDeleteInstancesResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsDeleteInstancesResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsDeleteInstancesPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsDeletePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsDeleteResponse will be returned. +func (p *VirtualMachineScaleSetsDeletePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsDeleteResponse, error) { + respType := VirtualMachineScaleSetsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsPerformMaintenancePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsPerformMaintenancePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsPerformMaintenancePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsPerformMaintenancePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsPerformMaintenanceResponse will be returned. +func (p *VirtualMachineScaleSetsPerformMaintenancePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsPerformMaintenanceResponse, error) { + respType := VirtualMachineScaleSetsPerformMaintenanceResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsPerformMaintenanceResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsPerformMaintenancePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsPowerOffPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsPowerOffPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsPowerOffPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsPowerOffPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsPowerOffResponse will be returned. +func (p *VirtualMachineScaleSetsPowerOffPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsPowerOffResponse, error) { + respType := VirtualMachineScaleSetsPowerOffResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsPowerOffResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsPowerOffPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsRedeployPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsRedeployPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsRedeployPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsRedeployPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsRedeployResponse will be returned. +func (p *VirtualMachineScaleSetsRedeployPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsRedeployResponse, error) { + respType := VirtualMachineScaleSetsRedeployResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsRedeployResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsRedeployPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsReimageAllPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsReimageAllPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsReimageAllPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsReimageAllPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsReimageAllResponse will be returned. +func (p *VirtualMachineScaleSetsReimageAllPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsReimageAllResponse, error) { + respType := VirtualMachineScaleSetsReimageAllResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsReimageAllResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsReimageAllPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsReimagePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsReimagePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsReimagePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsReimagePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsReimageResponse will be returned. +func (p *VirtualMachineScaleSetsReimagePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsReimageResponse, error) { + respType := VirtualMachineScaleSetsReimageResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsReimageResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsReimagePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsRestartPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsRestartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsRestartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsRestartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsRestartResponse will be returned. +func (p *VirtualMachineScaleSetsRestartPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsRestartResponse, error) { + respType := VirtualMachineScaleSetsRestartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsRestartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsRestartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsSetOrchestrationServiceStatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsSetOrchestrationServiceStatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsSetOrchestrationServiceStatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsSetOrchestrationServiceStatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsSetOrchestrationServiceStateResponse will be returned. +func (p *VirtualMachineScaleSetsSetOrchestrationServiceStatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsSetOrchestrationServiceStateResponse, error) { + respType := VirtualMachineScaleSetsSetOrchestrationServiceStateResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsSetOrchestrationServiceStateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsSetOrchestrationServiceStatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsStartPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsStartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsStartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsStartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsStartResponse will be returned. +func (p *VirtualMachineScaleSetsStartPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsStartResponse, error) { + respType := VirtualMachineScaleSetsStartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsStartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsStartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsUpdateInstancesPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsUpdateInstancesPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsUpdateInstancesPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsUpdateInstancesPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsUpdateInstancesResponse will be returned. +func (p *VirtualMachineScaleSetsUpdateInstancesPoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsUpdateInstancesResponse, error) { + respType := VirtualMachineScaleSetsUpdateInstancesResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachineScaleSetsUpdateInstancesResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsUpdateInstancesPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachineScaleSetsUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachineScaleSetsUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachineScaleSetsUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachineScaleSetsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachineScaleSetsUpdateResponse will be returned. +func (p *VirtualMachineScaleSetsUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachineScaleSetsUpdateResponse, error) { + respType := VirtualMachineScaleSetsUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineScaleSet) + if err != nil { + return VirtualMachineScaleSetsUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachineScaleSetsUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesAssessPatchesPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesAssessPatchesPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesAssessPatchesPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesAssessPatchesPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesAssessPatchesResponse will be returned. +func (p *VirtualMachinesAssessPatchesPoller) FinalResponse(ctx context.Context) (VirtualMachinesAssessPatchesResponse, error) { + respType := VirtualMachinesAssessPatchesResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineAssessPatchesResult) + if err != nil { + return VirtualMachinesAssessPatchesResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesAssessPatchesPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesCapturePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesCapturePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesCapturePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesCapturePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesCaptureResponse will be returned. +func (p *VirtualMachinesCapturePoller) FinalResponse(ctx context.Context) (VirtualMachinesCaptureResponse, error) { + respType := VirtualMachinesCaptureResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineCaptureResult) + if err != nil { + return VirtualMachinesCaptureResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesCapturePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesConvertToManagedDisksPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesConvertToManagedDisksPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesConvertToManagedDisksPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesConvertToManagedDisksPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesConvertToManagedDisksResponse will be returned. +func (p *VirtualMachinesConvertToManagedDisksPoller) FinalResponse(ctx context.Context) (VirtualMachinesConvertToManagedDisksResponse, error) { + respType := VirtualMachinesConvertToManagedDisksResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachinesConvertToManagedDisksResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesConvertToManagedDisksPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesCreateOrUpdateResponse will be returned. +func (p *VirtualMachinesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachinesCreateOrUpdateResponse, error) { + respType := VirtualMachinesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachine) + if err != nil { + return VirtualMachinesCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesDeallocatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesDeallocatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesDeallocatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesDeallocatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesDeallocateResponse will be returned. +func (p *VirtualMachinesDeallocatePoller) FinalResponse(ctx context.Context) (VirtualMachinesDeallocateResponse, error) { + respType := VirtualMachinesDeallocateResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachinesDeallocateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesDeallocatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesDeletePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesDeleteResponse will be returned. +func (p *VirtualMachinesDeletePoller) FinalResponse(ctx context.Context) (VirtualMachinesDeleteResponse, error) { + respType := VirtualMachinesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachinesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesInstallPatchesPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesInstallPatchesPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesInstallPatchesPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesInstallPatchesPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesInstallPatchesResponse will be returned. +func (p *VirtualMachinesInstallPatchesPoller) FinalResponse(ctx context.Context) (VirtualMachinesInstallPatchesResponse, error) { + respType := VirtualMachinesInstallPatchesResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachineInstallPatchesResult) + if err != nil { + return VirtualMachinesInstallPatchesResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesInstallPatchesPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesPerformMaintenancePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesPerformMaintenancePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesPerformMaintenancePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesPerformMaintenancePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesPerformMaintenanceResponse will be returned. +func (p *VirtualMachinesPerformMaintenancePoller) FinalResponse(ctx context.Context) (VirtualMachinesPerformMaintenanceResponse, error) { + respType := VirtualMachinesPerformMaintenanceResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachinesPerformMaintenanceResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesPerformMaintenancePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesPowerOffPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesPowerOffPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesPowerOffPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesPowerOffPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesPowerOffResponse will be returned. +func (p *VirtualMachinesPowerOffPoller) FinalResponse(ctx context.Context) (VirtualMachinesPowerOffResponse, error) { + respType := VirtualMachinesPowerOffResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachinesPowerOffResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesPowerOffPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesReapplyPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesReapplyPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesReapplyPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesReapplyPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesReapplyResponse will be returned. +func (p *VirtualMachinesReapplyPoller) FinalResponse(ctx context.Context) (VirtualMachinesReapplyResponse, error) { + respType := VirtualMachinesReapplyResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachinesReapplyResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesReapplyPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesRedeployPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesRedeployPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesRedeployPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesRedeployPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesRedeployResponse will be returned. +func (p *VirtualMachinesRedeployPoller) FinalResponse(ctx context.Context) (VirtualMachinesRedeployResponse, error) { + respType := VirtualMachinesRedeployResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachinesRedeployResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesRedeployPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesReimagePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesReimagePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesReimagePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesReimagePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesReimageResponse will be returned. +func (p *VirtualMachinesReimagePoller) FinalResponse(ctx context.Context) (VirtualMachinesReimageResponse, error) { + respType := VirtualMachinesReimageResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachinesReimageResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesReimagePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesRestartPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesRestartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesRestartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesRestartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesRestartResponse will be returned. +func (p *VirtualMachinesRestartPoller) FinalResponse(ctx context.Context) (VirtualMachinesRestartResponse, error) { + respType := VirtualMachinesRestartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachinesRestartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesRestartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesRunCommandPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesRunCommandPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesRunCommandPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesRunCommandPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesRunCommandResponse will be returned. +func (p *VirtualMachinesRunCommandPoller) FinalResponse(ctx context.Context) (VirtualMachinesRunCommandResponse, error) { + respType := VirtualMachinesRunCommandResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.RunCommandResult) + if err != nil { + return VirtualMachinesRunCommandResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesRunCommandPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesStartPoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesStartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesStartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesStartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesStartResponse will be returned. +func (p *VirtualMachinesStartPoller) FinalResponse(ctx context.Context) (VirtualMachinesStartResponse, error) { + respType := VirtualMachinesStartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return VirtualMachinesStartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesStartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// VirtualMachinesUpdatePoller provides polling facilities until the operation reaches a terminal state. +type VirtualMachinesUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *VirtualMachinesUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *VirtualMachinesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final VirtualMachinesUpdateResponse will be returned. +func (p *VirtualMachinesUpdatePoller) FinalResponse(ctx context.Context) (VirtualMachinesUpdateResponse, error) { + respType := VirtualMachinesUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.VirtualMachine) if err != nil { - return VirtualMachineScaleSetVMResponse{}, err + return VirtualMachinesUpdateResponse{}, err } respType.RawResponse = resp return respType, nil } + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *VirtualMachinesUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/compute/armcompute/zz_generated_proximityplacementgroups_client.go b/sdk/compute/armcompute/zz_generated_proximityplacementgroups_client.go index 1881586759f8..1a18b411a1fc 100644 --- a/sdk/compute/armcompute/zz_generated_proximityplacementgroups_client.go +++ b/sdk/compute/armcompute/zz_generated_proximityplacementgroups_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,44 +11,47 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ProximityPlacementGroupsClient contains the methods for the ProximityPlacementGroups group. // Don't use this type directly, use NewProximityPlacementGroupsClient() instead. type ProximityPlacementGroupsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewProximityPlacementGroupsClient creates a new instance of ProximityPlacementGroupsClient with the specified values. -func NewProximityPlacementGroupsClient(con *armcore.Connection, subscriptionID string) *ProximityPlacementGroupsClient { - return &ProximityPlacementGroupsClient{con: con, subscriptionID: subscriptionID} +func NewProximityPlacementGroupsClient(con *arm.Connection, subscriptionID string) *ProximityPlacementGroupsClient { + return &ProximityPlacementGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // CreateOrUpdate - Create or update a proximity placement group. // If the operation fails it returns a generic error. -func (client *ProximityPlacementGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup, options *ProximityPlacementGroupsCreateOrUpdateOptions) (ProximityPlacementGroupResponse, error) { +func (client *ProximityPlacementGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup, options *ProximityPlacementGroupsCreateOrUpdateOptions) (ProximityPlacementGroupsCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, parameters, options) if err != nil { - return ProximityPlacementGroupResponse{}, err + return ProximityPlacementGroupsCreateOrUpdateResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return ProximityPlacementGroupResponse{}, err + return ProximityPlacementGroupsCreateOrUpdateResponse{}, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { - return ProximityPlacementGroupResponse{}, client.createOrUpdateHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ProximityPlacementGroupsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) } return client.createOrUpdateHandleResponse(resp) } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ProximityPlacementGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup, options *ProximityPlacementGroupsCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *ProximityPlacementGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroup, options *ProximityPlacementGroupsCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -61,58 +65,57 @@ func (client *ProximityPlacementGroupsClient) createOrUpdateCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ProximityPlacementGroupsClient) createOrUpdateHandleResponse(resp *azcore.Response) (ProximityPlacementGroupResponse, error) { - var val *ProximityPlacementGroup - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ProximityPlacementGroupResponse{}, err +func (client *ProximityPlacementGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (ProximityPlacementGroupsCreateOrUpdateResponse, error) { + result := ProximityPlacementGroupsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroup); err != nil { + return ProximityPlacementGroupsCreateOrUpdateResponse{}, err } - return ProximityPlacementGroupResponse{RawResponse: resp.Response, ProximityPlacementGroup: val}, nil + return result, nil } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *ProximityPlacementGroupsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ProximityPlacementGroupsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Delete - Delete a proximity placement group. // If the operation fails it returns a generic error. -func (client *ProximityPlacementGroupsClient) Delete(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsDeleteOptions) (*http.Response, error) { +func (client *ProximityPlacementGroupsClient) Delete(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsDeleteOptions) (ProximityPlacementGroupsDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, options) if err != nil { - return nil, err + return ProximityPlacementGroupsDeleteResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return nil, err + return ProximityPlacementGroupsDeleteResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return nil, client.deleteHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProximityPlacementGroupsDeleteResponse{}, client.deleteHandleError(resp) } - return resp.Response, nil + return ProximityPlacementGroupsDeleteResponse{RawResponse: resp}, nil } // deleteCreateRequest creates the Delete request. -func (client *ProximityPlacementGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsDeleteOptions) (*azcore.Request, error) { +func (client *ProximityPlacementGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -126,48 +129,47 @@ func (client *ProximityPlacementGroupsClient) deleteCreateRequest(ctx context.Co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *ProximityPlacementGroupsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ProximityPlacementGroupsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Retrieves information about a proximity placement group . // If the operation fails it returns a generic error. -func (client *ProximityPlacementGroupsClient) Get(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsGetOptions) (ProximityPlacementGroupResponse, error) { +func (client *ProximityPlacementGroupsClient) Get(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsGetOptions) (ProximityPlacementGroupsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, options) if err != nil { - return ProximityPlacementGroupResponse{}, err + return ProximityPlacementGroupsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return ProximityPlacementGroupResponse{}, err + return ProximityPlacementGroupsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return ProximityPlacementGroupResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProximityPlacementGroupsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *ProximityPlacementGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsGetOptions) (*azcore.Request, error) { +func (client *ProximityPlacementGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, options *ProximityPlacementGroupsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -181,61 +183,57 @@ func (client *ProximityPlacementGroupsClient) getCreateRequest(ctx context.Conte return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.IncludeColocationStatus != nil { reqQP.Set("includeColocationStatus", *options.IncludeColocationStatus) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *ProximityPlacementGroupsClient) getHandleResponse(resp *azcore.Response) (ProximityPlacementGroupResponse, error) { - var val *ProximityPlacementGroup - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ProximityPlacementGroupResponse{}, err +func (client *ProximityPlacementGroupsClient) getHandleResponse(resp *http.Response) (ProximityPlacementGroupsGetResponse, error) { + result := ProximityPlacementGroupsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroup); err != nil { + return ProximityPlacementGroupsGetResponse{}, err } - return ProximityPlacementGroupResponse{RawResponse: resp.Response, ProximityPlacementGroup: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *ProximityPlacementGroupsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ProximityPlacementGroupsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListByResourceGroup - Lists all proximity placement groups in a resource group. // If the operation fails it returns a generic error. -func (client *ProximityPlacementGroupsClient) ListByResourceGroup(resourceGroupName string, options *ProximityPlacementGroupsListByResourceGroupOptions) ProximityPlacementGroupListResultPager { - return &proximityPlacementGroupListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *ProximityPlacementGroupsClient) ListByResourceGroup(resourceGroupName string, options *ProximityPlacementGroupsListByResourceGroupOptions) *ProximityPlacementGroupsListByResourceGroupPager { + return &ProximityPlacementGroupsListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listByResourceGroupHandleResponse, - errorer: client.listByResourceGroupHandleError, - advancer: func(ctx context.Context, resp ProximityPlacementGroupListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.ProximityPlacementGroupListResult.NextLink) + advancer: func(ctx context.Context, resp ProximityPlacementGroupsListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ProximityPlacementGroupListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ProximityPlacementGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ProximityPlacementGroupsListByResourceGroupOptions) (*azcore.Request, error) { +func (client *ProximityPlacementGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ProximityPlacementGroupsListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -245,115 +243,110 @@ func (client *ProximityPlacementGroupsClient) listByResourceGroupCreateRequest(c return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *ProximityPlacementGroupsClient) listByResourceGroupHandleResponse(resp *azcore.Response) (ProximityPlacementGroupListResultResponse, error) { - var val *ProximityPlacementGroupListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ProximityPlacementGroupListResultResponse{}, err +func (client *ProximityPlacementGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (ProximityPlacementGroupsListByResourceGroupResponse, error) { + result := ProximityPlacementGroupsListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroupListResult); err != nil { + return ProximityPlacementGroupsListByResourceGroupResponse{}, err } - return ProximityPlacementGroupListResultResponse{RawResponse: resp.Response, ProximityPlacementGroupListResult: val}, nil + return result, nil } // listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *ProximityPlacementGroupsClient) listByResourceGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ProximityPlacementGroupsClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListBySubscription - Lists all proximity placement groups in a subscription. // If the operation fails it returns a generic error. -func (client *ProximityPlacementGroupsClient) ListBySubscription(options *ProximityPlacementGroupsListBySubscriptionOptions) ProximityPlacementGroupListResultPager { - return &proximityPlacementGroupListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *ProximityPlacementGroupsClient) ListBySubscription(options *ProximityPlacementGroupsListBySubscriptionOptions) *ProximityPlacementGroupsListBySubscriptionPager { + return &ProximityPlacementGroupsListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listBySubscriptionCreateRequest(ctx, options) }, - responder: client.listBySubscriptionHandleResponse, - errorer: client.listBySubscriptionHandleError, - advancer: func(ctx context.Context, resp ProximityPlacementGroupListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.ProximityPlacementGroupListResult.NextLink) + advancer: func(ctx context.Context, resp ProximityPlacementGroupsListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ProximityPlacementGroupListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ProximityPlacementGroupsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ProximityPlacementGroupsListBySubscriptionOptions) (*azcore.Request, error) { +func (client *ProximityPlacementGroupsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ProximityPlacementGroupsListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *ProximityPlacementGroupsClient) listBySubscriptionHandleResponse(resp *azcore.Response) (ProximityPlacementGroupListResultResponse, error) { - var val *ProximityPlacementGroupListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ProximityPlacementGroupListResultResponse{}, err +func (client *ProximityPlacementGroupsClient) listBySubscriptionHandleResponse(resp *http.Response) (ProximityPlacementGroupsListBySubscriptionResponse, error) { + result := ProximityPlacementGroupsListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroupListResult); err != nil { + return ProximityPlacementGroupsListBySubscriptionResponse{}, err } - return ProximityPlacementGroupListResultResponse{RawResponse: resp.Response, ProximityPlacementGroupListResult: val}, nil + return result, nil } // listBySubscriptionHandleError handles the ListBySubscription error response. -func (client *ProximityPlacementGroupsClient) listBySubscriptionHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ProximityPlacementGroupsClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Update - Update a proximity placement group. // If the operation fails it returns a generic error. -func (client *ProximityPlacementGroupsClient) Update(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate, options *ProximityPlacementGroupsUpdateOptions) (ProximityPlacementGroupResponse, error) { +func (client *ProximityPlacementGroupsClient) Update(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate, options *ProximityPlacementGroupsUpdateOptions) (ProximityPlacementGroupsUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, proximityPlacementGroupName, parameters, options) if err != nil { - return ProximityPlacementGroupResponse{}, err + return ProximityPlacementGroupsUpdateResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return ProximityPlacementGroupResponse{}, err + return ProximityPlacementGroupsUpdateResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return ProximityPlacementGroupResponse{}, client.updateHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProximityPlacementGroupsUpdateResponse{}, client.updateHandleError(resp) } return client.updateHandleResponse(resp) } // updateCreateRequest creates the Update request. -func (client *ProximityPlacementGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate, options *ProximityPlacementGroupsUpdateOptions) (*azcore.Request, error) { +func (client *ProximityPlacementGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, proximityPlacementGroupName string, parameters ProximityPlacementGroupUpdate, options *ProximityPlacementGroupsUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -367,35 +360,34 @@ func (client *ProximityPlacementGroupsClient) updateCreateRequest(ctx context.Co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // updateHandleResponse handles the Update response. -func (client *ProximityPlacementGroupsClient) updateHandleResponse(resp *azcore.Response) (ProximityPlacementGroupResponse, error) { - var val *ProximityPlacementGroup - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ProximityPlacementGroupResponse{}, err +func (client *ProximityPlacementGroupsClient) updateHandleResponse(resp *http.Response) (ProximityPlacementGroupsUpdateResponse, error) { + result := ProximityPlacementGroupsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroup); err != nil { + return ProximityPlacementGroupsUpdateResponse{}, err } - return ProximityPlacementGroupResponse{RawResponse: resp.Response, ProximityPlacementGroup: val}, nil + return result, nil } // updateHandleError handles the Update error response. -func (client *ProximityPlacementGroupsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ProximityPlacementGroupsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_resourceskus_client.go b/sdk/compute/armcompute/zz_generated_resourceskus_client.go index f353bc2c1ee0..9a96d01d0e42 100644 --- a/sdk/compute/armcompute/zz_generated_resourceskus_client.go +++ b/sdk/compute/armcompute/zz_generated_resourceskus_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,81 +11,83 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ResourceSKUsClient contains the methods for the ResourceSKUs group. // Don't use this type directly, use NewResourceSKUsClient() instead. type ResourceSKUsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewResourceSKUsClient creates a new instance of ResourceSKUsClient with the specified values. -func NewResourceSKUsClient(con *armcore.Connection, subscriptionID string) *ResourceSKUsClient { - return &ResourceSKUsClient{con: con, subscriptionID: subscriptionID} +func NewResourceSKUsClient(con *arm.Connection, subscriptionID string) *ResourceSKUsClient { + return &ResourceSKUsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // List - Gets the list of Microsoft.Compute SKUs available for your Subscription. // If the operation fails it returns a generic error. -func (client *ResourceSKUsClient) List(options *ResourceSKUsListOptions) ResourceSKUsResultPager { - return &resourceSKUsResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *ResourceSKUsClient) List(options *ResourceSKUsListOptions) *ResourceSKUsListPager { + return &ResourceSKUsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp ResourceSKUsResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.ResourceSKUsResult.NextLink) + advancer: func(ctx context.Context, resp ResourceSKUsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ResourceSKUsResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, options *ResourceSKUsListOptions) (*azcore.Request, error) { +func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, options *ResourceSKUsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/skus" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2019-04-01") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + if options != nil && options.IncludeExtendedLocations != nil { + reqQP.Set("includeExtendedLocations", *options.IncludeExtendedLocations) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *ResourceSKUsClient) listHandleResponse(resp *azcore.Response) (ResourceSKUsResultResponse, error) { - var val *ResourceSKUsResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ResourceSKUsResultResponse{}, err +func (client *ResourceSKUsClient) listHandleResponse(resp *http.Response) (ResourceSKUsListResponse, error) { + result := ResourceSKUsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceSKUsResult); err != nil { + return ResourceSKUsListResponse{}, err } - return ResourceSKUsResultResponse{RawResponse: resp.Response, ResourceSKUsResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *ResourceSKUsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *ResourceSKUsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_response_types.go b/sdk/compute/armcompute/zz_generated_response_types.go index 531537a9cdc7..abc0f2956d52 100644 --- a/sdk/compute/armcompute/zz_generated_response_types.go +++ b/sdk/compute/armcompute/zz_generated_response_types.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,1249 +12,7480 @@ import ( "context" "net/http" "time" + + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) -// AccessURIPollerResponse is the response envelope for operations that asynchronously return a AccessURI type. -type AccessURIPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (AccessURIResponse, error) +// AvailabilitySetsCreateOrUpdateResponse contains the response from method AvailabilitySets.CreateOrUpdate. +type AvailabilitySetsCreateOrUpdateResponse struct { + AvailabilitySetsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} - // Poller contains an initialized poller. - Poller AccessURIPoller +// AvailabilitySetsCreateOrUpdateResult contains the result from method AvailabilitySets.CreateOrUpdate. +type AvailabilitySetsCreateOrUpdateResult struct { + AvailabilitySet +} +// AvailabilitySetsDeleteResponse contains the response from method AvailabilitySets.Delete. +type AvailabilitySetsDeleteResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// AccessURIResponse is the response envelope for operations that return a AccessURI type. -type AccessURIResponse struct { - // A disk access SAS uri. - AccessURI *AccessURI - +// AvailabilitySetsGetResponse contains the response from method AvailabilitySets.Get. +type AvailabilitySetsGetResponse struct { + AvailabilitySetsGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// AvailabilitySetListResultResponse is the response envelope for operations that return a AvailabilitySetListResult type. -type AvailabilitySetListResultResponse struct { - // The List Availability Set operation response. - AvailabilitySetListResult *AvailabilitySetListResult +// AvailabilitySetsGetResult contains the result from method AvailabilitySets.Get. +type AvailabilitySetsGetResult struct { + AvailabilitySet +} +// AvailabilitySetsListAvailableSizesResponse contains the response from method AvailabilitySets.ListAvailableSizes. +type AvailabilitySetsListAvailableSizesResponse struct { + AvailabilitySetsListAvailableSizesResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// AvailabilitySetResponse is the response envelope for operations that return a AvailabilitySet type. -type AvailabilitySetResponse 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. - AvailabilitySet *AvailabilitySet +// AvailabilitySetsListAvailableSizesResult contains the result from method AvailabilitySets.ListAvailableSizes. +type AvailabilitySetsListAvailableSizesResult struct { + VirtualMachineSizeListResult +} +// AvailabilitySetsListBySubscriptionResponse contains the response from method AvailabilitySets.ListBySubscription. +type AvailabilitySetsListBySubscriptionResponse struct { + AvailabilitySetsListBySubscriptionResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// CloudServiceInstanceViewResponse is the response envelope for operations that return a CloudServiceInstanceView type. -type CloudServiceInstanceViewResponse struct { - // InstanceView of CloudService as a whole - CloudServiceInstanceView *CloudServiceInstanceView +// AvailabilitySetsListBySubscriptionResult contains the result from method AvailabilitySets.ListBySubscription. +type AvailabilitySetsListBySubscriptionResult struct { + AvailabilitySetListResult +} +// AvailabilitySetsListResponse contains the response from method AvailabilitySets.List. +type AvailabilitySetsListResponse struct { + AvailabilitySetsListResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// CloudServiceListResultResponse is the response envelope for operations that return a CloudServiceListResult type. -type CloudServiceListResultResponse struct { - CloudServiceListResult *CloudServiceListResult +// AvailabilitySetsListResult contains the result from method AvailabilitySets.List. +type AvailabilitySetsListResult struct { + AvailabilitySetListResult +} +// AvailabilitySetsUpdateResponse contains the response from method AvailabilitySets.Update. +type AvailabilitySetsUpdateResponse struct { + AvailabilitySetsUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// CloudServicePollerResponse is the response envelope for operations that asynchronously return a CloudService type. -type CloudServicePollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (CloudServiceResponse, error) - - // Poller contains an initialized poller. - Poller CloudServicePoller +// AvailabilitySetsUpdateResult contains the result from method AvailabilitySets.Update. +type AvailabilitySetsUpdateResult struct { + AvailabilitySet +} +// CapacityReservationGroupsCreateOrUpdateResponse contains the response from method CapacityReservationGroups.CreateOrUpdate. +type CapacityReservationGroupsCreateOrUpdateResponse struct { + CapacityReservationGroupsCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// CloudServiceResponse is the response envelope for operations that return a CloudService type. -type CloudServiceResponse struct { - // Describes the cloud service. - CloudService *CloudService +// CapacityReservationGroupsCreateOrUpdateResult contains the result from method CapacityReservationGroups.CreateOrUpdate. +type CapacityReservationGroupsCreateOrUpdateResult struct { + CapacityReservationGroup +} +// CapacityReservationGroupsDeleteResponse contains the response from method CapacityReservationGroups.Delete. +type CapacityReservationGroupsDeleteResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// CloudServiceRoleListResultResponse is the response envelope for operations that return a CloudServiceRoleListResult type. -type CloudServiceRoleListResultResponse struct { - CloudServiceRoleListResult *CloudServiceRoleListResult - +// CapacityReservationGroupsGetResponse contains the response from method CapacityReservationGroups.Get. +type CapacityReservationGroupsGetResponse struct { + CapacityReservationGroupsGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// CloudServiceRoleResponse is the response envelope for operations that return a CloudServiceRole type. -type CloudServiceRoleResponse struct { - // Describes a role of the cloud service. - CloudServiceRole *CloudServiceRole +// CapacityReservationGroupsGetResult contains the result from method CapacityReservationGroups.Get. +type CapacityReservationGroupsGetResult struct { + CapacityReservationGroup +} +// CapacityReservationGroupsListByResourceGroupResponse contains the response from method CapacityReservationGroups.ListByResourceGroup. +type CapacityReservationGroupsListByResourceGroupResponse struct { + CapacityReservationGroupsListByResourceGroupResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ComputeOperationListResultResponse is the response envelope for operations that return a ComputeOperationListResult type. -type ComputeOperationListResultResponse struct { - // The List Compute Operation operation response. - ComputeOperationListResult *ComputeOperationListResult +// CapacityReservationGroupsListByResourceGroupResult contains the result from method CapacityReservationGroups.ListByResourceGroup. +type CapacityReservationGroupsListByResourceGroupResult struct { + CapacityReservationGroupListResult +} +// CapacityReservationGroupsListBySubscriptionResponse contains the response from method CapacityReservationGroups.ListBySubscription. +type CapacityReservationGroupsListBySubscriptionResponse struct { + CapacityReservationGroupsListBySubscriptionResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DedicatedHostGroupListResultResponse is the response envelope for operations that return a DedicatedHostGroupListResult type. -type DedicatedHostGroupListResultResponse struct { - // The List Dedicated Host Group with resource group response. - DedicatedHostGroupListResult *DedicatedHostGroupListResult +// CapacityReservationGroupsListBySubscriptionResult contains the result from method CapacityReservationGroups.ListBySubscription. +type CapacityReservationGroupsListBySubscriptionResult struct { + CapacityReservationGroupListResult +} +// CapacityReservationGroupsUpdateResponse contains the response from method CapacityReservationGroups.Update. +type CapacityReservationGroupsUpdateResponse struct { + CapacityReservationGroupsUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DedicatedHostGroupResponse is the response envelope for operations that return a DedicatedHostGroup type. -type DedicatedHostGroupResponse struct { - // 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. - DedicatedHostGroup *DedicatedHostGroup +// CapacityReservationGroupsUpdateResult contains the result from method CapacityReservationGroups.Update. +type CapacityReservationGroupsUpdateResult struct { + CapacityReservationGroup +} + +// CapacityReservationsCreateOrUpdatePollerResponse contains the response from method CapacityReservations.CreateOrUpdate. +type CapacityReservationsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *CapacityReservationsCreateOrUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DedicatedHostListResultResponse is the response envelope for operations that return a DedicatedHostListResult type. -type DedicatedHostListResultResponse struct { - // The list dedicated host operation response. - DedicatedHostListResult *DedicatedHostListResult - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CapacityReservationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CapacityReservationsCreateOrUpdateResponse, error) { + respType := CapacityReservationsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CapacityReservation) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CapacityReservationsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *CapacityReservationsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *CapacityReservationsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CapacityReservationsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &CapacityReservationsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CapacityReservationsCreateOrUpdateResponse contains the response from method CapacityReservations.CreateOrUpdate. +type CapacityReservationsCreateOrUpdateResponse struct { + CapacityReservationsCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DedicatedHostPollerResponse is the response envelope for operations that asynchronously return a DedicatedHost type. -type DedicatedHostPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (DedicatedHostResponse, error) +// CapacityReservationsCreateOrUpdateResult contains the result from method CapacityReservations.CreateOrUpdate. +type CapacityReservationsCreateOrUpdateResult struct { + CapacityReservation +} +// CapacityReservationsDeletePollerResponse contains the response from method CapacityReservations.Delete. +type CapacityReservationsDeletePollerResponse struct { // Poller contains an initialized poller. - Poller DedicatedHostPoller + Poller *CapacityReservationsDeletePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DedicatedHostResponse is the response envelope for operations that return a DedicatedHost type. -type DedicatedHostResponse struct { - // Specifies information about the Dedicated host. - DedicatedHost *DedicatedHost +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CapacityReservationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CapacityReservationsDeleteResponse, error) { + respType := CapacityReservationsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CapacityReservationsDeletePollerResponse from the provided client and resume token. +func (l *CapacityReservationsDeletePollerResponse) Resume(ctx context.Context, client *CapacityReservationsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CapacityReservationsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &CapacityReservationsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CapacityReservationsDeleteResponse contains the response from method CapacityReservations.Delete. +type CapacityReservationsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} +// CapacityReservationsGetResponse contains the response from method CapacityReservations.Get. +type CapacityReservationsGetResponse struct { + CapacityReservationsGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskAccessListResponse is the response envelope for operations that return a DiskAccessList type. -type DiskAccessListResponse struct { - // The List disk access operation response. - DiskAccessList *DiskAccessList +// CapacityReservationsGetResult contains the result from method CapacityReservations.Get. +type CapacityReservationsGetResult struct { + CapacityReservation +} +// CapacityReservationsListByCapacityReservationGroupResponse contains the response from method CapacityReservations.ListByCapacityReservationGroup. +type CapacityReservationsListByCapacityReservationGroupResponse struct { + CapacityReservationsListByCapacityReservationGroupResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskAccessPollerResponse is the response envelope for operations that asynchronously return a DiskAccess type. -type DiskAccessPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (DiskAccessResponse, error) +// CapacityReservationsListByCapacityReservationGroupResult contains the result from method CapacityReservations.ListByCapacityReservationGroup. +type CapacityReservationsListByCapacityReservationGroupResult struct { + CapacityReservationListResult +} +// CapacityReservationsUpdatePollerResponse contains the response from method CapacityReservations.Update. +type CapacityReservationsUpdatePollerResponse struct { // Poller contains an initialized poller. - Poller DiskAccessPoller + Poller *CapacityReservationsUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskAccessResponse is the response envelope for operations that return a DiskAccess type. -type DiskAccessResponse struct { - // disk access resource. - DiskAccess *DiskAccess - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CapacityReservationsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CapacityReservationsUpdateResponse, error) { + respType := CapacityReservationsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CapacityReservation) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CapacityReservationsUpdatePollerResponse from the provided client and resume token. +func (l *CapacityReservationsUpdatePollerResponse) Resume(ctx context.Context, client *CapacityReservationsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CapacityReservationsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &CapacityReservationsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CapacityReservationsUpdateResponse contains the response from method CapacityReservations.Update. +type CapacityReservationsUpdateResponse struct { + CapacityReservationsUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskEncryptionSetListResponse is the response envelope for operations that return a DiskEncryptionSetList type. -type DiskEncryptionSetListResponse struct { - // The List disk encryption set operation response. - DiskEncryptionSetList *DiskEncryptionSetList +// CapacityReservationsUpdateResult contains the result from method CapacityReservations.Update. +type CapacityReservationsUpdateResult struct { + CapacityReservation +} +// CloudServiceOperatingSystemsGetOSFamilyResponse contains the response from method CloudServiceOperatingSystems.GetOSFamily. +type CloudServiceOperatingSystemsGetOSFamilyResponse struct { + CloudServiceOperatingSystemsGetOSFamilyResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskEncryptionSetPollerResponse is the response envelope for operations that asynchronously return a DiskEncryptionSet type. -type DiskEncryptionSetPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (DiskEncryptionSetResponse, error) - - // Poller contains an initialized poller. - Poller DiskEncryptionSetPoller +// CloudServiceOperatingSystemsGetOSFamilyResult contains the result from method CloudServiceOperatingSystems.GetOSFamily. +type CloudServiceOperatingSystemsGetOSFamilyResult struct { + OSFamily +} +// CloudServiceOperatingSystemsGetOSVersionResponse contains the response from method CloudServiceOperatingSystems.GetOSVersion. +type CloudServiceOperatingSystemsGetOSVersionResponse struct { + CloudServiceOperatingSystemsGetOSVersionResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskEncryptionSetResponse is the response envelope for operations that return a DiskEncryptionSet type. -type DiskEncryptionSetResponse struct { - // disk encryption set resource. - DiskEncryptionSet *DiskEncryptionSet +// CloudServiceOperatingSystemsGetOSVersionResult contains the result from method CloudServiceOperatingSystems.GetOSVersion. +type CloudServiceOperatingSystemsGetOSVersionResult struct { + OSVersion +} +// CloudServiceOperatingSystemsListOSFamiliesResponse contains the response from method CloudServiceOperatingSystems.ListOSFamilies. +type CloudServiceOperatingSystemsListOSFamiliesResponse struct { + CloudServiceOperatingSystemsListOSFamiliesResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskListResponse is the response envelope for operations that return a DiskList type. -type DiskListResponse struct { - // The List Disks operation response. - DiskList *DiskList +// CloudServiceOperatingSystemsListOSFamiliesResult contains the result from method CloudServiceOperatingSystems.ListOSFamilies. +type CloudServiceOperatingSystemsListOSFamiliesResult struct { + OSFamilyListResult +} +// CloudServiceOperatingSystemsListOSVersionsResponse contains the response from method CloudServiceOperatingSystems.ListOSVersions. +type CloudServiceOperatingSystemsListOSVersionsResponse struct { + CloudServiceOperatingSystemsListOSVersionsResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskPollerResponse is the response envelope for operations that asynchronously return a Disk type. -type DiskPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (DiskResponse, error) +// CloudServiceOperatingSystemsListOSVersionsResult contains the result from method CloudServiceOperatingSystems.ListOSVersions. +type CloudServiceOperatingSystemsListOSVersionsResult struct { + OSVersionListResult +} +// CloudServiceRoleInstancesDeletePollerResponse contains the response from method CloudServiceRoleInstances.Delete. +type CloudServiceRoleInstancesDeletePollerResponse struct { // Poller contains an initialized poller. - Poller DiskPoller + Poller *CloudServiceRoleInstancesDeletePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskResponse is the response envelope for operations that return a Disk type. -type DiskResponse struct { - // Disk resource. - Disk *Disk +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServiceRoleInstancesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServiceRoleInstancesDeleteResponse, error) { + respType := CloudServiceRoleInstancesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServiceRoleInstancesDeletePollerResponse from the provided client and resume token. +func (l *CloudServiceRoleInstancesDeletePollerResponse) Resume(ctx context.Context, client *CloudServiceRoleInstancesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServiceRoleInstancesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &CloudServiceRoleInstancesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServiceRoleInstancesDeleteResponse contains the response from method CloudServiceRoleInstances.Delete. +type CloudServiceRoleInstancesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} +// CloudServiceRoleInstancesGetInstanceViewResponse contains the response from method CloudServiceRoleInstances.GetInstanceView. +type CloudServiceRoleInstancesGetInstanceViewResponse struct { + CloudServiceRoleInstancesGetInstanceViewResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskRestorePointListResponse is the response envelope for operations that return a DiskRestorePointList type. -type DiskRestorePointListResponse struct { - // The List Disk Restore Points operation response. - DiskRestorePointList *DiskRestorePointList +// CloudServiceRoleInstancesGetInstanceViewResult contains the result from method CloudServiceRoleInstances.GetInstanceView. +type CloudServiceRoleInstancesGetInstanceViewResult struct { + RoleInstanceView +} +// CloudServiceRoleInstancesGetRemoteDesktopFileResponse contains the response from method CloudServiceRoleInstances.GetRemoteDesktopFile. +type CloudServiceRoleInstancesGetRemoteDesktopFileResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// DiskRestorePointResponse is the response envelope for operations that return a DiskRestorePoint type. -type DiskRestorePointResponse struct { - // Properties of disk restore point - DiskRestorePoint *DiskRestorePoint - +// CloudServiceRoleInstancesGetResponse contains the response from method CloudServiceRoleInstances.Get. +type CloudServiceRoleInstancesGetResponse struct { + CloudServiceRoleInstancesGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryApplicationListResponse is the response envelope for operations that return a GalleryApplicationList type. -type GalleryApplicationListResponse struct { - // The List Gallery Applications operation response. - GalleryApplicationList *GalleryApplicationList +// CloudServiceRoleInstancesGetResult contains the result from method CloudServiceRoleInstances.Get. +type CloudServiceRoleInstancesGetResult struct { + RoleInstance +} +// CloudServiceRoleInstancesListResponse contains the response from method CloudServiceRoleInstances.List. +type CloudServiceRoleInstancesListResponse struct { + CloudServiceRoleInstancesListResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryApplicationPollerResponse is the response envelope for operations that asynchronously return a GalleryApplication type. -type GalleryApplicationPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (GalleryApplicationResponse, error) +// CloudServiceRoleInstancesListResult contains the result from method CloudServiceRoleInstances.List. +type CloudServiceRoleInstancesListResult struct { + RoleInstanceListResult +} +// CloudServiceRoleInstancesRebuildPollerResponse contains the response from method CloudServiceRoleInstances.Rebuild. +type CloudServiceRoleInstancesRebuildPollerResponse struct { // Poller contains an initialized poller. - Poller GalleryApplicationPoller + Poller *CloudServiceRoleInstancesRebuildPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryApplicationResponse is the response envelope for operations that return a GalleryApplication type. -type GalleryApplicationResponse struct { - // Specifies information about the gallery Application Definition that you want to create or update. - GalleryApplication *GalleryApplication - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServiceRoleInstancesRebuildPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServiceRoleInstancesRebuildResponse, error) { + respType := CloudServiceRoleInstancesRebuildResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServiceRoleInstancesRebuildPollerResponse from the provided client and resume token. +func (l *CloudServiceRoleInstancesRebuildPollerResponse) Resume(ctx context.Context, client *CloudServiceRoleInstancesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServiceRoleInstancesClient.Rebuild", token, client.pl, client.rebuildHandleError) + if err != nil { + return err + } + poller := &CloudServiceRoleInstancesRebuildPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServiceRoleInstancesRebuildResponse contains the response from method CloudServiceRoleInstances.Rebuild. +type CloudServiceRoleInstancesRebuildResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryApplicationVersionListResponse is the response envelope for operations that return a GalleryApplicationVersionList type. -type GalleryApplicationVersionListResponse struct { - // The List Gallery Application version operation response. - GalleryApplicationVersionList *GalleryApplicationVersionList +// CloudServiceRoleInstancesReimagePollerResponse contains the response from method CloudServiceRoleInstances.Reimage. +type CloudServiceRoleInstancesReimagePollerResponse struct { + // Poller contains an initialized poller. + Poller *CloudServiceRoleInstancesReimagePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryApplicationVersionPollerResponse is the response envelope for operations that asynchronously return a GalleryApplicationVersion type. -type GalleryApplicationVersionPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (GalleryApplicationVersionResponse, error) +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServiceRoleInstancesReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServiceRoleInstancesReimageResponse, error) { + respType := CloudServiceRoleInstancesReimageResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServiceRoleInstancesReimagePollerResponse from the provided client and resume token. +func (l *CloudServiceRoleInstancesReimagePollerResponse) Resume(ctx context.Context, client *CloudServiceRoleInstancesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServiceRoleInstancesClient.Reimage", token, client.pl, client.reimageHandleError) + if err != nil { + return err + } + poller := &CloudServiceRoleInstancesReimagePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServiceRoleInstancesReimageResponse contains the response from method CloudServiceRoleInstances.Reimage. +type CloudServiceRoleInstancesReimageResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} +// CloudServiceRoleInstancesRestartPollerResponse contains the response from method CloudServiceRoleInstances.Restart. +type CloudServiceRoleInstancesRestartPollerResponse struct { // Poller contains an initialized poller. - Poller GalleryApplicationVersionPoller + Poller *CloudServiceRoleInstancesRestartPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryApplicationVersionResponse is the response envelope for operations that return a GalleryApplicationVersion type. -type GalleryApplicationVersionResponse struct { - // Specifies information about the gallery Application Version that you want to create or update. - GalleryApplicationVersion *GalleryApplicationVersion +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServiceRoleInstancesRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServiceRoleInstancesRestartResponse, error) { + respType := CloudServiceRoleInstancesRestartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServiceRoleInstancesRestartPollerResponse from the provided client and resume token. +func (l *CloudServiceRoleInstancesRestartPollerResponse) Resume(ctx context.Context, client *CloudServiceRoleInstancesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServiceRoleInstancesClient.Restart", token, client.pl, client.restartHandleError) + if err != nil { + return err + } + poller := &CloudServiceRoleInstancesRestartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServiceRoleInstancesRestartResponse contains the response from method CloudServiceRoleInstances.Restart. +type CloudServiceRoleInstancesRestartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} +// CloudServiceRolesGetResponse contains the response from method CloudServiceRoles.Get. +type CloudServiceRolesGetResponse struct { + CloudServiceRolesGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryImageListResponse is the response envelope for operations that return a GalleryImageList type. -type GalleryImageListResponse struct { - // The List Gallery Images operation response. - GalleryImageList *GalleryImageList +// CloudServiceRolesGetResult contains the result from method CloudServiceRoles.Get. +type CloudServiceRolesGetResult struct { + CloudServiceRole +} +// CloudServiceRolesListResponse contains the response from method CloudServiceRoles.List. +type CloudServiceRolesListResponse struct { + CloudServiceRolesListResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryImagePollerResponse is the response envelope for operations that asynchronously return a GalleryImage type. -type GalleryImagePollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (GalleryImageResponse, error) +// CloudServiceRolesListResult contains the result from method CloudServiceRoles.List. +type CloudServiceRolesListResult struct { + CloudServiceRoleListResult +} +// CloudServicesCreateOrUpdatePollerResponse contains the response from method CloudServices.CreateOrUpdate. +type CloudServicesCreateOrUpdatePollerResponse struct { // Poller contains an initialized poller. - Poller GalleryImagePoller + Poller *CloudServicesCreateOrUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryImageResponse is the response envelope for operations that return a GalleryImage type. -type GalleryImageResponse struct { - // Specifies information about the gallery image definition that you want to create or update. - GalleryImage *GalleryImage - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesCreateOrUpdateResponse, error) { + respType := CloudServicesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CloudService) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServicesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *CloudServicesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServicesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &CloudServicesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServicesCreateOrUpdateResponse contains the response from method CloudServices.CreateOrUpdate. +type CloudServicesCreateOrUpdateResponse struct { + CloudServicesCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryImageVersionListResponse is the response envelope for operations that return a GalleryImageVersionList type. -type GalleryImageVersionListResponse struct { - // The List Gallery Image version operation response. - GalleryImageVersionList *GalleryImageVersionList +// CloudServicesCreateOrUpdateResult contains the result from method CloudServices.CreateOrUpdate. +type CloudServicesCreateOrUpdateResult struct { + CloudService +} + +// CloudServicesDeleteInstancesPollerResponse contains the response from method CloudServices.DeleteInstances. +type CloudServicesDeleteInstancesPollerResponse struct { + // Poller contains an initialized poller. + Poller *CloudServicesDeleteInstancesPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryImageVersionPollerResponse is the response envelope for operations that asynchronously return a GalleryImageVersion type. -type GalleryImageVersionPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (GalleryImageVersionResponse, error) +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServicesDeleteInstancesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesDeleteInstancesResponse, error) { + respType := CloudServicesDeleteInstancesResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServicesDeleteInstancesPollerResponse from the provided client and resume token. +func (l *CloudServicesDeleteInstancesPollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServicesClient.DeleteInstances", token, client.pl, client.deleteInstancesHandleError) + if err != nil { + return err + } + poller := &CloudServicesDeleteInstancesPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServicesDeleteInstancesResponse contains the response from method CloudServices.DeleteInstances. +type CloudServicesDeleteInstancesResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} +// CloudServicesDeletePollerResponse contains the response from method CloudServices.Delete. +type CloudServicesDeletePollerResponse struct { // Poller contains an initialized poller. - Poller GalleryImageVersionPoller + Poller *CloudServicesDeletePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryImageVersionResponse is the response envelope for operations that return a GalleryImageVersion type. -type GalleryImageVersionResponse struct { - // Specifies information about the gallery image version that you want to create or update. - GalleryImageVersion *GalleryImageVersion +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesDeleteResponse, error) { + respType := CloudServicesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServicesDeletePollerResponse from the provided client and resume token. +func (l *CloudServicesDeletePollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServicesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &CloudServicesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServicesDeleteResponse contains the response from method CloudServices.Delete. +type CloudServicesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} +// CloudServicesGetInstanceViewResponse contains the response from method CloudServices.GetInstanceView. +type CloudServicesGetInstanceViewResponse struct { + CloudServicesGetInstanceViewResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryListResponse is the response envelope for operations that return a GalleryList type. -type GalleryListResponse struct { - // The List Galleries operation response. - GalleryList *GalleryList +// CloudServicesGetInstanceViewResult contains the result from method CloudServices.GetInstanceView. +type CloudServicesGetInstanceViewResult struct { + CloudServiceInstanceView +} +// CloudServicesGetResponse contains the response from method CloudServices.Get. +type CloudServicesGetResponse struct { + CloudServicesGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryPollerResponse is the response envelope for operations that asynchronously return a Gallery type. -type GalleryPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (GalleryResponse, error) - - // Poller contains an initialized poller. - Poller GalleryPoller +// CloudServicesGetResult contains the result from method CloudServices.Get. +type CloudServicesGetResult struct { + CloudService +} +// CloudServicesListAllResponse contains the response from method CloudServices.ListAll. +type CloudServicesListAllResponse struct { + CloudServicesListAllResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// GalleryResponse is the response envelope for operations that return a Gallery type. -type GalleryResponse struct { - // Specifies information about the Shared Image Gallery that you want to create or update. - Gallery *Gallery +// CloudServicesListAllResult contains the result from method CloudServices.ListAll. +type CloudServicesListAllResult struct { + CloudServiceListResult +} +// CloudServicesListResponse contains the response from method CloudServices.List. +type CloudServicesListResponse struct { + CloudServicesListResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// HTTPPollerResponse contains the asynchronous HTTP response from the call to the service endpoint. -type HTTPPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (*http.Response, error) +// CloudServicesListResult contains the result from method CloudServices.List. +type CloudServicesListResult struct { + CloudServiceListResult +} +// CloudServicesPowerOffPollerResponse contains the response from method CloudServices.PowerOff. +type CloudServicesPowerOffPollerResponse struct { // Poller contains an initialized poller. - Poller HTTPPoller + Poller *CloudServicesPowerOffPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ImageListResultResponse is the response envelope for operations that return a ImageListResult type. -type ImageListResultResponse struct { - // The List Image operation response. - ImageListResult *ImageListResult - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServicesPowerOffPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesPowerOffResponse, error) { + respType := CloudServicesPowerOffResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServicesPowerOffPollerResponse from the provided client and resume token. +func (l *CloudServicesPowerOffPollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServicesClient.PowerOff", token, client.pl, client.powerOffHandleError) + if err != nil { + return err + } + poller := &CloudServicesPowerOffPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServicesPowerOffResponse contains the response from method CloudServices.PowerOff. +type CloudServicesPowerOffResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ImagePollerResponse is the response envelope for operations that asynchronously return a Image type. -type ImagePollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (ImageResponse, error) - +// CloudServicesRebuildPollerResponse contains the response from method CloudServices.Rebuild. +type CloudServicesRebuildPollerResponse struct { // Poller contains an initialized poller. - Poller ImagePoller + Poller *CloudServicesRebuildPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ImageResponse is the response envelope for operations that return a Image type. -type ImageResponse struct { - // The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, - // the destination virtual hard drive must not exist. - Image *Image - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServicesRebuildPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesRebuildResponse, error) { + respType := CloudServicesRebuildResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServicesRebuildPollerResponse from the provided client and resume token. +func (l *CloudServicesRebuildPollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServicesClient.Rebuild", token, client.pl, client.rebuildHandleError) + if err != nil { + return err + } + poller := &CloudServicesRebuildPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServicesRebuildResponse contains the response from method CloudServices.Rebuild. +type CloudServicesRebuildResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ListUsagesResultResponse is the response envelope for operations that return a ListUsagesResult type. -type ListUsagesResultResponse struct { - // The List Usages operation response. - ListUsagesResult *ListUsagesResult +// CloudServicesReimagePollerResponse contains the response from method CloudServices.Reimage. +type CloudServicesReimagePollerResponse struct { + // Poller contains an initialized poller. + Poller *CloudServicesReimagePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// LogAnalyticsOperationResultPollerResponse is the response envelope for operations that asynchronously return a LogAnalyticsOperationResult type. -type LogAnalyticsOperationResultPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (LogAnalyticsOperationResultResponse, error) - - // Poller contains an initialized poller. - Poller LogAnalyticsOperationResultPoller - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServicesReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesReimageResponse, error) { + respType := CloudServicesReimageResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServicesReimagePollerResponse from the provided client and resume token. +func (l *CloudServicesReimagePollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServicesClient.Reimage", token, client.pl, client.reimageHandleError) + if err != nil { + return err + } + poller := &CloudServicesReimagePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServicesReimageResponse contains the response from method CloudServices.Reimage. +type CloudServicesReimageResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// LogAnalyticsOperationResultResponse is the response envelope for operations that return a LogAnalyticsOperationResult type. -type LogAnalyticsOperationResultResponse struct { - // LogAnalytics operation status response - LogAnalyticsOperationResult *LogAnalyticsOperationResult +// CloudServicesRestartPollerResponse contains the response from method CloudServices.Restart. +type CloudServicesRestartPollerResponse struct { + // Poller contains an initialized poller. + Poller *CloudServicesRestartPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// OSFamilyListResultResponse is the response envelope for operations that return a OSFamilyListResult type. -type OSFamilyListResultResponse struct { - OSFamilyListResult *OSFamilyListResult - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServicesRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesRestartResponse, error) { + respType := CloudServicesRestartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServicesRestartPollerResponse from the provided client and resume token. +func (l *CloudServicesRestartPollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServicesClient.Restart", token, client.pl, client.restartHandleError) + if err != nil { + return err + } + poller := &CloudServicesRestartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServicesRestartResponse contains the response from method CloudServices.Restart. +type CloudServicesRestartResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// OSFamilyResponse is the response envelope for operations that return a OSFamily type. -type OSFamilyResponse struct { - // Describes a cloud service OS family. - OSFamily *OSFamily +// CloudServicesStartPollerResponse contains the response from method CloudServices.Start. +type CloudServicesStartPollerResponse struct { + // Poller contains an initialized poller. + Poller *CloudServicesStartPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// OSVersionListResultResponse is the response envelope for operations that return a OSVersionListResult type. -type OSVersionListResultResponse struct { - OSVersionListResult *OSVersionListResult - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServicesStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesStartResponse, error) { + respType := CloudServicesStartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServicesStartPollerResponse from the provided client and resume token. +func (l *CloudServicesStartPollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServicesClient.Start", token, client.pl, client.startHandleError) + if err != nil { + return err + } + poller := &CloudServicesStartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServicesStartResponse contains the response from method CloudServices.Start. +type CloudServicesStartResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// OSVersionResponse is the response envelope for operations that return a OSVersion type. -type OSVersionResponse struct { - // Describes a cloud service OS version. - OSVersion *OSVersion - +// CloudServicesUpdateDomainGetUpdateDomainResponse contains the response from method CloudServicesUpdateDomain.GetUpdateDomain. +type CloudServicesUpdateDomainGetUpdateDomainResponse struct { + CloudServicesUpdateDomainGetUpdateDomainResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// PrivateEndpointConnectionListResultResponse is the response envelope for operations that return a PrivateEndpointConnectionListResult type. -type PrivateEndpointConnectionListResultResponse struct { - // A list of private link resources - PrivateEndpointConnectionListResult *PrivateEndpointConnectionListResult +// CloudServicesUpdateDomainGetUpdateDomainResult contains the result from method CloudServicesUpdateDomain.GetUpdateDomain. +type CloudServicesUpdateDomainGetUpdateDomainResult struct { + UpdateDomain +} +// CloudServicesUpdateDomainListUpdateDomainsResponse contains the response from method CloudServicesUpdateDomain.ListUpdateDomains. +type CloudServicesUpdateDomainListUpdateDomainsResponse struct { + CloudServicesUpdateDomainListUpdateDomainsResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// PrivateEndpointConnectionPollerResponse is the response envelope for operations that asynchronously return a PrivateEndpointConnection type. -type PrivateEndpointConnectionPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (PrivateEndpointConnectionResponse, error) +// CloudServicesUpdateDomainListUpdateDomainsResult contains the result from method CloudServicesUpdateDomain.ListUpdateDomains. +type CloudServicesUpdateDomainListUpdateDomainsResult struct { + UpdateDomainListResult +} +// CloudServicesUpdateDomainWalkUpdateDomainPollerResponse contains the response from method CloudServicesUpdateDomain.WalkUpdateDomain. +type CloudServicesUpdateDomainWalkUpdateDomainPollerResponse struct { // Poller contains an initialized poller. - Poller PrivateEndpointConnectionPoller + Poller *CloudServicesUpdateDomainWalkUpdateDomainPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// PrivateEndpointConnectionResponse is the response envelope for operations that return a PrivateEndpointConnection type. -type PrivateEndpointConnectionResponse struct { - // The Private Endpoint Connection resource. - PrivateEndpointConnection *PrivateEndpointConnection - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServicesUpdateDomainWalkUpdateDomainPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesUpdateDomainWalkUpdateDomainResponse, error) { + respType := CloudServicesUpdateDomainWalkUpdateDomainResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServicesUpdateDomainWalkUpdateDomainPollerResponse from the provided client and resume token. +func (l *CloudServicesUpdateDomainWalkUpdateDomainPollerResponse) Resume(ctx context.Context, client *CloudServicesUpdateDomainClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServicesUpdateDomainClient.WalkUpdateDomain", token, client.pl, client.walkUpdateDomainHandleError) + if err != nil { + return err + } + poller := &CloudServicesUpdateDomainWalkUpdateDomainPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServicesUpdateDomainWalkUpdateDomainResponse contains the response from method CloudServicesUpdateDomain.WalkUpdateDomain. +type CloudServicesUpdateDomainWalkUpdateDomainResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// PrivateLinkResourceListResultResponse is the response envelope for operations that return a PrivateLinkResourceListResult type. -type PrivateLinkResourceListResultResponse struct { - // A list of private link resources - PrivateLinkResourceListResult *PrivateLinkResourceListResult +// CloudServicesUpdatePollerResponse contains the response from method CloudServices.Update. +type CloudServicesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *CloudServicesUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ProximityPlacementGroupListResultResponse is the response envelope for operations that return a ProximityPlacementGroupListResult type. -type ProximityPlacementGroupListResultResponse struct { - // The List Proximity Placement Group operation response. - ProximityPlacementGroupListResult *ProximityPlacementGroupListResult - +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l CloudServicesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesUpdateResponse, error) { + respType := CloudServicesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CloudService) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CloudServicesUpdatePollerResponse from the provided client and resume token. +func (l *CloudServicesUpdatePollerResponse) Resume(ctx context.Context, client *CloudServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CloudServicesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &CloudServicesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CloudServicesUpdateResponse contains the response from method CloudServices.Update. +type CloudServicesUpdateResponse struct { + CloudServicesUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// ProximityPlacementGroupResponse is the response envelope for operations that return a ProximityPlacementGroup type. -type ProximityPlacementGroupResponse struct { - // Specifies information about the proximity placement group. - ProximityPlacementGroup *ProximityPlacementGroup +// CloudServicesUpdateResult contains the result from method CloudServices.Update. +type CloudServicesUpdateResult struct { + CloudService +} +// DedicatedHostGroupsCreateOrUpdateResponse contains the response from method DedicatedHostGroups.CreateOrUpdate. +type DedicatedHostGroupsCreateOrUpdateResponse struct { + DedicatedHostGroupsCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// RecoveryWalkResponseResponse is the response envelope for operations that return a RecoveryWalkResponse type. -type RecoveryWalkResponseResponse struct { +// DedicatedHostGroupsCreateOrUpdateResult contains the result from method DedicatedHostGroups.CreateOrUpdate. +type DedicatedHostGroupsCreateOrUpdateResult struct { + DedicatedHostGroup +} + +// DedicatedHostGroupsDeleteResponse contains the response from method DedicatedHostGroups.Delete. +type DedicatedHostGroupsDeleteResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // Response after calling a manual recovery walk - RecoveryWalkResponse *RecoveryWalkResponse } -// ResourceSKUsResultResponse is the response envelope for operations that return a ResourceSKUsResult type. -type ResourceSKUsResultResponse struct { +// DedicatedHostGroupsGetResponse contains the response from method DedicatedHostGroups.Get. +type DedicatedHostGroupsGetResponse struct { + DedicatedHostGroupsGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List Resource Skus operation response. - ResourceSKUsResult *ResourceSKUsResult +// DedicatedHostGroupsGetResult contains the result from method DedicatedHostGroups.Get. +type DedicatedHostGroupsGetResult struct { + DedicatedHostGroup } -// ResourceURIListResponse is the response envelope for operations that return a ResourceURIList type. -type ResourceURIListResponse struct { +// DedicatedHostGroupsListByResourceGroupResponse contains the response from method DedicatedHostGroups.ListByResourceGroup. +type DedicatedHostGroupsListByResourceGroupResponse struct { + DedicatedHostGroupsListByResourceGroupResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List resources which are encrypted with the disk encryption set. - ResourceURIList *ResourceURIList +// DedicatedHostGroupsListByResourceGroupResult contains the result from method DedicatedHostGroups.ListByResourceGroup. +type DedicatedHostGroupsListByResourceGroupResult struct { + DedicatedHostGroupListResult } -// RestorePointCollectionListResultResponse is the response envelope for operations that return a RestorePointCollectionListResult type. -type RestorePointCollectionListResultResponse struct { +// DedicatedHostGroupsListBySubscriptionResponse contains the response from method DedicatedHostGroups.ListBySubscription. +type DedicatedHostGroupsListBySubscriptionResponse struct { + DedicatedHostGroupsListBySubscriptionResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List restore point collection operation response. - RestorePointCollectionListResult *RestorePointCollectionListResult +// DedicatedHostGroupsListBySubscriptionResult contains the result from method DedicatedHostGroups.ListBySubscription. +type DedicatedHostGroupsListBySubscriptionResult struct { + DedicatedHostGroupListResult } -// RestorePointCollectionResponse is the response envelope for operations that return a RestorePointCollection type. -type RestorePointCollectionResponse struct { +// DedicatedHostGroupsUpdateResponse contains the response from method DedicatedHostGroups.Update. +type DedicatedHostGroupsUpdateResponse struct { + DedicatedHostGroupsUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // Create or update Restore Point collection parameters. - RestorePointCollection *RestorePointCollection } -// RestorePointPollerResponse is the response envelope for operations that asynchronously return a RestorePoint type. -type RestorePointPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (RestorePointResponse, error) +// DedicatedHostGroupsUpdateResult contains the result from method DedicatedHostGroups.Update. +type DedicatedHostGroupsUpdateResult struct { + DedicatedHostGroup +} +// DedicatedHostsCreateOrUpdatePollerResponse contains the response from method DedicatedHosts.CreateOrUpdate. +type DedicatedHostsCreateOrUpdatePollerResponse struct { // Poller contains an initialized poller. - Poller RestorePointPoller + Poller *DedicatedHostsCreateOrUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// RestorePointResponse is the response envelope for operations that return a RestorePoint type. -type RestorePointResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DedicatedHostsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DedicatedHostsCreateOrUpdateResponse, error) { + respType := DedicatedHostsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DedicatedHost) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DedicatedHostsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *DedicatedHostsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DedicatedHostsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DedicatedHostsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &DedicatedHostsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DedicatedHostsCreateOrUpdateResponse contains the response from method DedicatedHosts.CreateOrUpdate. +type DedicatedHostsCreateOrUpdateResponse struct { + DedicatedHostsCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Restore Point details. - RestorePoint *RestorePoint +// DedicatedHostsCreateOrUpdateResult contains the result from method DedicatedHosts.CreateOrUpdate. +type DedicatedHostsCreateOrUpdateResult struct { + DedicatedHost } -// RetrieveBootDiagnosticsDataResultResponse is the response envelope for operations that return a RetrieveBootDiagnosticsDataResult type. -type RetrieveBootDiagnosticsDataResultResponse struct { +// DedicatedHostsDeletePollerResponse contains the response from method DedicatedHosts.Delete. +type DedicatedHostsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *DedicatedHostsDeletePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // The SAS URIs of the console screenshot and serial log blobs. - RetrieveBootDiagnosticsDataResult *RetrieveBootDiagnosticsDataResult } -// RoleInstanceListResultResponse is the response envelope for operations that return a RoleInstanceListResult type. -type RoleInstanceListResultResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DedicatedHostsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DedicatedHostsDeleteResponse, error) { + respType := DedicatedHostsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DedicatedHostsDeletePollerResponse from the provided client and resume token. +func (l *DedicatedHostsDeletePollerResponse) Resume(ctx context.Context, client *DedicatedHostsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DedicatedHostsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &DedicatedHostsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DedicatedHostsDeleteResponse contains the response from method DedicatedHosts.Delete. +type DedicatedHostsDeleteResponse struct { // RawResponse contains the underlying HTTP response. - RawResponse *http.Response - RoleInstanceListResult *RoleInstanceListResult + RawResponse *http.Response } -// RoleInstanceResponse is the response envelope for operations that return a RoleInstance type. -type RoleInstanceResponse struct { +// DedicatedHostsGetResponse contains the response from method DedicatedHosts.Get. +type DedicatedHostsGetResponse struct { + DedicatedHostsGetResult // RawResponse contains the underlying HTTP response. - RawResponse *http.Response - RoleInstance *RoleInstance + RawResponse *http.Response +} + +// DedicatedHostsGetResult contains the result from method DedicatedHosts.Get. +type DedicatedHostsGetResult struct { + DedicatedHost } -// RoleInstanceViewResponse is the response envelope for operations that return a RoleInstanceView type. -type RoleInstanceViewResponse struct { +// DedicatedHostsListByHostGroupResponse contains the response from method DedicatedHosts.ListByHostGroup. +type DedicatedHostsListByHostGroupResponse struct { + DedicatedHostsListByHostGroupResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The instance view of the role instance. - RoleInstanceView *RoleInstanceView +// DedicatedHostsListByHostGroupResult contains the result from method DedicatedHosts.ListByHostGroup. +type DedicatedHostsListByHostGroupResult struct { + DedicatedHostListResult } -// RollingUpgradeStatusInfoResponse is the response envelope for operations that return a RollingUpgradeStatusInfo type. -type RollingUpgradeStatusInfoResponse struct { +// DedicatedHostsUpdatePollerResponse contains the response from method DedicatedHosts.Update. +type DedicatedHostsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *DedicatedHostsUpdatePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // The status of the latest virtual machine scale set rolling upgrade. - RollingUpgradeStatusInfo *RollingUpgradeStatusInfo } -// RunCommandDocumentResponse is the response envelope for operations that return a RunCommandDocument type. -type RunCommandDocumentResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DedicatedHostsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DedicatedHostsUpdateResponse, error) { + respType := DedicatedHostsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DedicatedHost) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DedicatedHostsUpdatePollerResponse from the provided client and resume token. +func (l *DedicatedHostsUpdatePollerResponse) Resume(ctx context.Context, client *DedicatedHostsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DedicatedHostsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &DedicatedHostsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DedicatedHostsUpdateResponse contains the response from method DedicatedHosts.Update. +type DedicatedHostsUpdateResponse struct { + DedicatedHostsUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Describes the properties of a Run Command. - RunCommandDocument *RunCommandDocument +// DedicatedHostsUpdateResult contains the result from method DedicatedHosts.Update. +type DedicatedHostsUpdateResult struct { + DedicatedHost } -// RunCommandListResultResponse is the response envelope for operations that return a RunCommandListResult type. -type RunCommandListResultResponse struct { +// DiskAccessesCreateOrUpdatePollerResponse contains the response from method DiskAccesses.CreateOrUpdate. +type DiskAccessesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *DiskAccessesCreateOrUpdatePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List Virtual Machine operation response. - RunCommandListResult *RunCommandListResult +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DiskAccessesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesCreateOrUpdateResponse, error) { + respType := DiskAccessesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiskAccess) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiskAccessesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *DiskAccessesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DiskAccessesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiskAccessesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &DiskAccessesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiskAccessesCreateOrUpdateResponse contains the response from method DiskAccesses.CreateOrUpdate. +type DiskAccessesCreateOrUpdateResponse struct { + DiskAccessesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// RunCommandResultPollerResponse is the response envelope for operations that asynchronously return a RunCommandResult type. -type RunCommandResultPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (RunCommandResultResponse, error) +// DiskAccessesCreateOrUpdateResult contains the result from method DiskAccesses.CreateOrUpdate. +type DiskAccessesCreateOrUpdateResult struct { + DiskAccess +} +// DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse contains the response from method DiskAccesses.DeleteAPrivateEndpointConnection. +type DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse struct { // Poller contains an initialized poller. - Poller RunCommandResultPoller + Poller *DiskAccessesDeleteAPrivateEndpointConnectionPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// RunCommandResultResponse is the response envelope for operations that return a RunCommandResult type. -type RunCommandResultResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesDeleteAPrivateEndpointConnectionResponse, error) { + respType := DiskAccessesDeleteAPrivateEndpointConnectionResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse from the provided client and resume token. +func (l *DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse) Resume(ctx context.Context, client *DiskAccessesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiskAccessesClient.DeleteAPrivateEndpointConnection", token, client.pl, client.deleteAPrivateEndpointConnectionHandleError) + if err != nil { + return err + } + poller := &DiskAccessesDeleteAPrivateEndpointConnectionPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiskAccessesDeleteAPrivateEndpointConnectionResponse contains the response from method DiskAccesses.DeleteAPrivateEndpointConnection. +type DiskAccessesDeleteAPrivateEndpointConnectionResponse struct { // RawResponse contains the underlying HTTP response. - RawResponse *http.Response - RunCommandResult *RunCommandResult + RawResponse *http.Response } -// SSHPublicKeyGenerateKeyPairResultResponse is the response envelope for operations that return a SSHPublicKeyGenerateKeyPairResult type. -type SSHPublicKeyGenerateKeyPairResultResponse struct { +// DiskAccessesDeletePollerResponse contains the response from method DiskAccesses.Delete. +type DiskAccessesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *DiskAccessesDeletePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // Response from generation of an SSH key pair. - SSHPublicKeyGenerateKeyPairResult *SSHPublicKeyGenerateKeyPairResult } -// SSHPublicKeyResourceResponse is the response envelope for operations that return a SSHPublicKeyResource type. -type SSHPublicKeyResourceResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DiskAccessesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesDeleteResponse, error) { + respType := DiskAccessesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiskAccessesDeletePollerResponse from the provided client and resume token. +func (l *DiskAccessesDeletePollerResponse) Resume(ctx context.Context, client *DiskAccessesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiskAccessesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &DiskAccessesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiskAccessesDeleteResponse contains the response from method DiskAccesses.Delete. +type DiskAccessesDeleteResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // Specifies information about the SSH public key. - SSHPublicKeyResource *SSHPublicKeyResource } -// SSHPublicKeysGroupListResultResponse is the response envelope for operations that return a SSHPublicKeysGroupListResult type. -type SSHPublicKeysGroupListResultResponse struct { +// DiskAccessesGetAPrivateEndpointConnectionResponse contains the response from method DiskAccesses.GetAPrivateEndpointConnection. +type DiskAccessesGetAPrivateEndpointConnectionResponse struct { + DiskAccessesGetAPrivateEndpointConnectionResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The list SSH public keys operation response. - SSHPublicKeysGroupListResult *SSHPublicKeysGroupListResult +// DiskAccessesGetAPrivateEndpointConnectionResult contains the result from method DiskAccesses.GetAPrivateEndpointConnection. +type DiskAccessesGetAPrivateEndpointConnectionResult struct { + PrivateEndpointConnection } -// SharedGalleryImageListResponse is the response envelope for operations that return a SharedGalleryImageList type. -type SharedGalleryImageListResponse struct { +// DiskAccessesGetPrivateLinkResourcesResponse contains the response from method DiskAccesses.GetPrivateLinkResources. +type DiskAccessesGetPrivateLinkResourcesResponse struct { + DiskAccessesGetPrivateLinkResourcesResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List Shared Gallery Images operation response. - SharedGalleryImageList *SharedGalleryImageList +// DiskAccessesGetPrivateLinkResourcesResult contains the result from method DiskAccesses.GetPrivateLinkResources. +type DiskAccessesGetPrivateLinkResourcesResult struct { + PrivateLinkResourceListResult } -// SharedGalleryImageResponse is the response envelope for operations that return a SharedGalleryImage type. -type SharedGalleryImageResponse struct { +// DiskAccessesGetResponse contains the response from method DiskAccesses.Get. +type DiskAccessesGetResponse struct { + DiskAccessesGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Specifies information about the gallery image definition that you want to create or update. - SharedGalleryImage *SharedGalleryImage +// DiskAccessesGetResult contains the result from method DiskAccesses.Get. +type DiskAccessesGetResult struct { + DiskAccess } -// SharedGalleryImageVersionListResponse is the response envelope for operations that return a SharedGalleryImageVersionList type. -type SharedGalleryImageVersionListResponse struct { +// DiskAccessesListByResourceGroupResponse contains the response from method DiskAccesses.ListByResourceGroup. +type DiskAccessesListByResourceGroupResponse struct { + DiskAccessesListByResourceGroupResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List Shared Gallery Image versions operation response. - SharedGalleryImageVersionList *SharedGalleryImageVersionList +// DiskAccessesListByResourceGroupResult contains the result from method DiskAccesses.ListByResourceGroup. +type DiskAccessesListByResourceGroupResult struct { + DiskAccessList } -// SharedGalleryImageVersionResponse is the response envelope for operations that return a SharedGalleryImageVersion type. -type SharedGalleryImageVersionResponse struct { +// DiskAccessesListPrivateEndpointConnectionsResponse contains the response from method DiskAccesses.ListPrivateEndpointConnections. +type DiskAccessesListPrivateEndpointConnectionsResponse struct { + DiskAccessesListPrivateEndpointConnectionsResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Specifies information about the gallery image version that you want to create or update. - SharedGalleryImageVersion *SharedGalleryImageVersion +// DiskAccessesListPrivateEndpointConnectionsResult contains the result from method DiskAccesses.ListPrivateEndpointConnections. +type DiskAccessesListPrivateEndpointConnectionsResult struct { + PrivateEndpointConnectionListResult } -// SharedGalleryListResponse is the response envelope for operations that return a SharedGalleryList type. -type SharedGalleryListResponse struct { +// DiskAccessesListResponse contains the response from method DiskAccesses.List. +type DiskAccessesListResponse struct { + DiskAccessesListResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List Shared Galleries operation response. - SharedGalleryList *SharedGalleryList +// DiskAccessesListResult contains the result from method DiskAccesses.List. +type DiskAccessesListResult struct { + DiskAccessList } -// SharedGalleryResponse is the response envelope for operations that return a SharedGallery type. -type SharedGalleryResponse struct { +// DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse contains the response from method DiskAccesses.UpdateAPrivateEndpointConnection. +type DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse struct { + // Poller contains an initialized poller. + Poller *DiskAccessesUpdateAPrivateEndpointConnectionPoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Specifies information about the Shared Gallery that you want to create or update. - SharedGallery *SharedGallery +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesUpdateAPrivateEndpointConnectionResponse, error) { + respType := DiskAccessesUpdateAPrivateEndpointConnectionResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse from the provided client and resume token. +func (l *DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse) Resume(ctx context.Context, client *DiskAccessesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiskAccessesClient.UpdateAPrivateEndpointConnection", token, client.pl, client.updateAPrivateEndpointConnectionHandleError) + if err != nil { + return err + } + poller := &DiskAccessesUpdateAPrivateEndpointConnectionPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiskAccessesUpdateAPrivateEndpointConnectionResponse contains the response from method DiskAccesses.UpdateAPrivateEndpointConnection. +type DiskAccessesUpdateAPrivateEndpointConnectionResponse struct { + DiskAccessesUpdateAPrivateEndpointConnectionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// SharingUpdatePollerResponse is the response envelope for operations that asynchronously return a SharingUpdate type. -type SharingUpdatePollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (SharingUpdateResponse, error) +// DiskAccessesUpdateAPrivateEndpointConnectionResult contains the result from method DiskAccesses.UpdateAPrivateEndpointConnection. +type DiskAccessesUpdateAPrivateEndpointConnectionResult struct { + PrivateEndpointConnection +} +// DiskAccessesUpdatePollerResponse contains the response from method DiskAccesses.Update. +type DiskAccessesUpdatePollerResponse struct { // Poller contains an initialized poller. - Poller SharingUpdatePoller + Poller *DiskAccessesUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// SharingUpdateResponse is the response envelope for operations that return a SharingUpdate type. -type SharingUpdateResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DiskAccessesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesUpdateResponse, error) { + respType := DiskAccessesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiskAccess) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiskAccessesUpdatePollerResponse from the provided client and resume token. +func (l *DiskAccessesUpdatePollerResponse) Resume(ctx context.Context, client *DiskAccessesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiskAccessesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &DiskAccessesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiskAccessesUpdateResponse contains the response from method DiskAccesses.Update. +type DiskAccessesUpdateResponse struct { + DiskAccessesUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Specifies information about the gallery sharing profile update. - SharingUpdate *SharingUpdate +// DiskAccessesUpdateResult contains the result from method DiskAccesses.Update. +type DiskAccessesUpdateResult struct { + DiskAccess } -// SnapshotListResponse is the response envelope for operations that return a SnapshotList type. -type SnapshotListResponse struct { +// DiskEncryptionSetsCreateOrUpdatePollerResponse contains the response from method DiskEncryptionSets.CreateOrUpdate. +type DiskEncryptionSetsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *DiskEncryptionSetsCreateOrUpdatePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List Snapshots operation response. - SnapshotList *SnapshotList +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DiskEncryptionSetsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskEncryptionSetsCreateOrUpdateResponse, error) { + respType := DiskEncryptionSetsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiskEncryptionSet) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiskEncryptionSetsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *DiskEncryptionSetsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DiskEncryptionSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiskEncryptionSetsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &DiskEncryptionSetsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiskEncryptionSetsCreateOrUpdateResponse contains the response from method DiskEncryptionSets.CreateOrUpdate. +type DiskEncryptionSetsCreateOrUpdateResponse struct { + DiskEncryptionSetsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// SnapshotPollerResponse is the response envelope for operations that asynchronously return a Snapshot type. -type SnapshotPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (SnapshotResponse, error) +// DiskEncryptionSetsCreateOrUpdateResult contains the result from method DiskEncryptionSets.CreateOrUpdate. +type DiskEncryptionSetsCreateOrUpdateResult struct { + DiskEncryptionSet +} +// DiskEncryptionSetsDeletePollerResponse contains the response from method DiskEncryptionSets.Delete. +type DiskEncryptionSetsDeletePollerResponse struct { // Poller contains an initialized poller. - Poller SnapshotPoller + Poller *DiskEncryptionSetsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DiskEncryptionSetsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskEncryptionSetsDeleteResponse, error) { + respType := DiskEncryptionSetsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiskEncryptionSetsDeletePollerResponse from the provided client and resume token. +func (l *DiskEncryptionSetsDeletePollerResponse) Resume(ctx context.Context, client *DiskEncryptionSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiskEncryptionSetsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &DiskEncryptionSetsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiskEncryptionSetsDeleteResponse contains the response from method DiskEncryptionSets.Delete. +type DiskEncryptionSetsDeleteResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// SnapshotResponse is the response envelope for operations that return a Snapshot type. -type SnapshotResponse struct { +// DiskEncryptionSetsGetResponse contains the response from method DiskEncryptionSets.Get. +type DiskEncryptionSetsGetResponse struct { + DiskEncryptionSetsGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Snapshot resource. - Snapshot *Snapshot +// DiskEncryptionSetsGetResult contains the result from method DiskEncryptionSets.Get. +type DiskEncryptionSetsGetResult struct { + DiskEncryptionSet } -// UpdateDomainListResultResponse is the response envelope for operations that return a UpdateDomainListResult type. -type UpdateDomainListResultResponse struct { +// DiskEncryptionSetsListAssociatedResourcesResponse contains the response from method DiskEncryptionSets.ListAssociatedResources. +type DiskEncryptionSetsListAssociatedResourcesResponse struct { + DiskEncryptionSetsListAssociatedResourcesResult // RawResponse contains the underlying HTTP response. - RawResponse *http.Response - UpdateDomainListResult *UpdateDomainListResult + RawResponse *http.Response +} + +// DiskEncryptionSetsListAssociatedResourcesResult contains the result from method DiskEncryptionSets.ListAssociatedResources. +type DiskEncryptionSetsListAssociatedResourcesResult struct { + ResourceURIList } -// UpdateDomainResponse is the response envelope for operations that return a UpdateDomain type. -type UpdateDomainResponse struct { +// DiskEncryptionSetsListByResourceGroupResponse contains the response from method DiskEncryptionSets.ListByResourceGroup. +type DiskEncryptionSetsListByResourceGroupResponse struct { + DiskEncryptionSetsListByResourceGroupResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Defines an update domain for the cloud service. - UpdateDomain *UpdateDomain +// DiskEncryptionSetsListByResourceGroupResult contains the result from method DiskEncryptionSets.ListByResourceGroup. +type DiskEncryptionSetsListByResourceGroupResult struct { + DiskEncryptionSetList +} + +// DiskEncryptionSetsListResponse contains the response from method DiskEncryptionSets.List. +type DiskEncryptionSetsListResponse struct { + DiskEncryptionSetsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// VirtualMachineAssessPatchesResultPollerResponse is the response envelope for operations that asynchronously return a VirtualMachineAssessPatchesResult -// type. -type VirtualMachineAssessPatchesResultPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (VirtualMachineAssessPatchesResultResponse, error) +// DiskEncryptionSetsListResult contains the result from method DiskEncryptionSets.List. +type DiskEncryptionSetsListResult struct { + DiskEncryptionSetList +} +// DiskEncryptionSetsUpdatePollerResponse contains the response from method DiskEncryptionSets.Update. +type DiskEncryptionSetsUpdatePollerResponse struct { // Poller contains an initialized poller. - Poller VirtualMachineAssessPatchesResultPoller + Poller *DiskEncryptionSetsUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// VirtualMachineAssessPatchesResultResponse is the response envelope for operations that return a VirtualMachineAssessPatchesResult type. -type VirtualMachineAssessPatchesResultResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DiskEncryptionSetsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskEncryptionSetsUpdateResponse, error) { + respType := DiskEncryptionSetsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiskEncryptionSet) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiskEncryptionSetsUpdatePollerResponse from the provided client and resume token. +func (l *DiskEncryptionSetsUpdatePollerResponse) Resume(ctx context.Context, client *DiskEncryptionSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiskEncryptionSetsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &DiskEncryptionSetsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiskEncryptionSetsUpdateResponse contains the response from method DiskEncryptionSets.Update. +type DiskEncryptionSetsUpdateResponse struct { + DiskEncryptionSetsUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} + +// DiskEncryptionSetsUpdateResult contains the result from method DiskEncryptionSets.Update. +type DiskEncryptionSetsUpdateResult struct { + DiskEncryptionSet +} - // Describes the properties of an AssessPatches result. - VirtualMachineAssessPatchesResult *VirtualMachineAssessPatchesResult +// DiskRestorePointGetResponse contains the response from method DiskRestorePoint.Get. +type DiskRestorePointGetResponse struct { + DiskRestorePointGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// VirtualMachineCaptureResultPollerResponse is the response envelope for operations that asynchronously return a VirtualMachineCaptureResult type. -type VirtualMachineCaptureResultPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (VirtualMachineCaptureResultResponse, error) +// DiskRestorePointGetResult contains the result from method DiskRestorePoint.Get. +type DiskRestorePointGetResult struct { + DiskRestorePoint +} +// DiskRestorePointGrantAccessPollerResponse contains the response from method DiskRestorePoint.GrantAccess. +type DiskRestorePointGrantAccessPollerResponse struct { // Poller contains an initialized poller. - Poller VirtualMachineCaptureResultPoller + Poller *DiskRestorePointGrantAccessPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// VirtualMachineCaptureResultResponse is the response envelope for operations that return a VirtualMachineCaptureResult type. -type VirtualMachineCaptureResultResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DiskRestorePointGrantAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskRestorePointGrantAccessResponse, error) { + respType := DiskRestorePointGrantAccessResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AccessURI) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiskRestorePointGrantAccessPollerResponse from the provided client and resume token. +func (l *DiskRestorePointGrantAccessPollerResponse) Resume(ctx context.Context, client *DiskRestorePointClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiskRestorePointClient.GrantAccess", token, client.pl, client.grantAccessHandleError) + if err != nil { + return err + } + poller := &DiskRestorePointGrantAccessPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiskRestorePointGrantAccessResponse contains the response from method DiskRestorePoint.GrantAccess. +type DiskRestorePointGrantAccessResponse struct { + DiskRestorePointGrantAccessResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Output of virtual machine capture operation. - VirtualMachineCaptureResult *VirtualMachineCaptureResult +// DiskRestorePointGrantAccessResult contains the result from method DiskRestorePoint.GrantAccess. +type DiskRestorePointGrantAccessResult struct { + AccessURI } -// VirtualMachineExtensionImageArrayResponse is the response envelope for operations that return a []*VirtualMachineExtensionImage type. -type VirtualMachineExtensionImageArrayResponse struct { +// DiskRestorePointListByRestorePointResponse contains the response from method DiskRestorePoint.ListByRestorePoint. +type DiskRestorePointListByRestorePointResponse struct { + DiskRestorePointListByRestorePointResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Array of VirtualMachineExtensionImage - VirtualMachineExtensionImageArray []*VirtualMachineExtensionImage +// DiskRestorePointListByRestorePointResult contains the result from method DiskRestorePoint.ListByRestorePoint. +type DiskRestorePointListByRestorePointResult struct { + DiskRestorePointList } -// VirtualMachineExtensionImageResponse is the response envelope for operations that return a VirtualMachineExtensionImage type. -type VirtualMachineExtensionImageResponse struct { +// DiskRestorePointRevokeAccessPollerResponse contains the response from method DiskRestorePoint.RevokeAccess. +type DiskRestorePointRevokeAccessPollerResponse struct { + // Poller contains an initialized poller. + Poller *DiskRestorePointRevokeAccessPoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // Describes a Virtual Machine Extension Image. - VirtualMachineExtensionImage *VirtualMachineExtensionImage } -// VirtualMachineExtensionPollerResponse is the response envelope for operations that asynchronously return a VirtualMachineExtension type. -type VirtualMachineExtensionPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (VirtualMachineExtensionResponse, error) +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DiskRestorePointRevokeAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskRestorePointRevokeAccessResponse, error) { + respType := DiskRestorePointRevokeAccessResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DiskRestorePointRevokeAccessPollerResponse from the provided client and resume token. +func (l *DiskRestorePointRevokeAccessPollerResponse) Resume(ctx context.Context, client *DiskRestorePointClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DiskRestorePointClient.RevokeAccess", token, client.pl, client.revokeAccessHandleError) + if err != nil { + return err + } + poller := &DiskRestorePointRevokeAccessPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DiskRestorePointRevokeAccessResponse contains the response from method DiskRestorePoint.RevokeAccess. +type DiskRestorePointRevokeAccessResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} +// DisksCreateOrUpdatePollerResponse contains the response from method Disks.CreateOrUpdate. +type DisksCreateOrUpdatePollerResponse struct { // Poller contains an initialized poller. - Poller VirtualMachineExtensionPoller + Poller *DisksCreateOrUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// VirtualMachineExtensionResponse is the response envelope for operations that return a VirtualMachineExtension type. -type VirtualMachineExtensionResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DisksCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksCreateOrUpdateResponse, error) { + respType := DisksCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Disk) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DisksCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *DisksCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *DisksClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DisksClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &DisksCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DisksCreateOrUpdateResponse contains the response from method Disks.CreateOrUpdate. +type DisksCreateOrUpdateResponse struct { + DisksCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Describes a Virtual Machine Extension. - VirtualMachineExtension *VirtualMachineExtension +// DisksCreateOrUpdateResult contains the result from method Disks.CreateOrUpdate. +type DisksCreateOrUpdateResult struct { + Disk } -// VirtualMachineExtensionsListResultResponse is the response envelope for operations that return a VirtualMachineExtensionsListResult type. -type VirtualMachineExtensionsListResultResponse struct { +// DisksDeletePollerResponse contains the response from method Disks.Delete. +type DisksDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *DisksDeletePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // The List Extension operation response - VirtualMachineExtensionsListResult *VirtualMachineExtensionsListResult } -// VirtualMachineImageResourceArrayResponse is the response envelope for operations that return a []*VirtualMachineImageResource type. -type VirtualMachineImageResourceArrayResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DisksDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksDeleteResponse, error) { + respType := DisksDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DisksDeletePollerResponse from the provided client and resume token. +func (l *DisksDeletePollerResponse) Resume(ctx context.Context, client *DisksClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DisksClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &DisksDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DisksDeleteResponse contains the response from method Disks.Delete. +type DisksDeleteResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // Array of VirtualMachineImageResource - VirtualMachineImageResourceArray []*VirtualMachineImageResource } -// VirtualMachineImageResponse is the response envelope for operations that return a VirtualMachineImage type. -type VirtualMachineImageResponse struct { +// DisksGetResponse contains the response from method Disks.Get. +type DisksGetResponse struct { + DisksGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // Describes a Virtual Machine Image. - VirtualMachineImage *VirtualMachineImage } -// VirtualMachineInstallPatchesResultPollerResponse is the response envelope for operations that asynchronously return a VirtualMachineInstallPatchesResult -// type. -type VirtualMachineInstallPatchesResultPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (VirtualMachineInstallPatchesResultResponse, error) +// DisksGetResult contains the result from method Disks.Get. +type DisksGetResult struct { + Disk +} +// DisksGrantAccessPollerResponse contains the response from method Disks.GrantAccess. +type DisksGrantAccessPollerResponse struct { // Poller contains an initialized poller. - Poller VirtualMachineInstallPatchesResultPoller + Poller *DisksGrantAccessPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// VirtualMachineInstallPatchesResultResponse is the response envelope for operations that return a VirtualMachineInstallPatchesResult type. -type VirtualMachineInstallPatchesResultResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DisksGrantAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksGrantAccessResponse, error) { + respType := DisksGrantAccessResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AccessURI) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DisksGrantAccessPollerResponse from the provided client and resume token. +func (l *DisksGrantAccessPollerResponse) Resume(ctx context.Context, client *DisksClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DisksClient.GrantAccess", token, client.pl, client.grantAccessHandleError) + if err != nil { + return err + } + poller := &DisksGrantAccessPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DisksGrantAccessResponse contains the response from method Disks.GrantAccess. +type DisksGrantAccessResponse struct { + DisksGrantAccessResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The result summary of an installation operation. - VirtualMachineInstallPatchesResult *VirtualMachineInstallPatchesResult +// DisksGrantAccessResult contains the result from method Disks.GrantAccess. +type DisksGrantAccessResult struct { + AccessURI } -// VirtualMachineInstanceViewResponse is the response envelope for operations that return a VirtualMachineInstanceView type. -type VirtualMachineInstanceViewResponse struct { +// DisksListByResourceGroupResponse contains the response from method Disks.ListByResourceGroup. +type DisksListByResourceGroupResponse struct { + DisksListByResourceGroupResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The instance view of a virtual machine. - VirtualMachineInstanceView *VirtualMachineInstanceView +// DisksListByResourceGroupResult contains the result from method Disks.ListByResourceGroup. +type DisksListByResourceGroupResult struct { + DiskList } -// VirtualMachineListResultResponse is the response envelope for operations that return a VirtualMachineListResult type. -type VirtualMachineListResultResponse struct { +// DisksListResponse contains the response from method Disks.List. +type DisksListResponse struct { + DisksListResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // The List Virtual Machine operation response. - VirtualMachineListResult *VirtualMachineListResult } -// VirtualMachinePollerResponse is the response envelope for operations that asynchronously return a VirtualMachine type. -type VirtualMachinePollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (VirtualMachineResponse, error) +// DisksListResult contains the result from method Disks.List. +type DisksListResult struct { + DiskList +} +// DisksRevokeAccessPollerResponse contains the response from method Disks.RevokeAccess. +type DisksRevokeAccessPollerResponse struct { // Poller contains an initialized poller. - Poller VirtualMachinePoller + Poller *DisksRevokeAccessPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DisksRevokeAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksRevokeAccessResponse, error) { + respType := DisksRevokeAccessResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DisksRevokeAccessPollerResponse from the provided client and resume token. +func (l *DisksRevokeAccessPollerResponse) Resume(ctx context.Context, client *DisksClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DisksClient.RevokeAccess", token, client.pl, client.revokeAccessHandleError) + if err != nil { + return err + } + poller := &DisksRevokeAccessPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DisksRevokeAccessResponse contains the response from method Disks.RevokeAccess. +type DisksRevokeAccessResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// VirtualMachineResponse is the response envelope for operations that return a VirtualMachine type. -type VirtualMachineResponse struct { +// DisksUpdatePollerResponse contains the response from method Disks.Update. +type DisksUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *DisksUpdatePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Describes a Virtual Machine. - VirtualMachine *VirtualMachine +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l DisksUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksUpdateResponse, error) { + respType := DisksUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Disk) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DisksUpdatePollerResponse from the provided client and resume token. +func (l *DisksUpdatePollerResponse) Resume(ctx context.Context, client *DisksClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DisksClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &DisksUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DisksUpdateResponse contains the response from method Disks.Update. +type DisksUpdateResponse struct { + DisksUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// VirtualMachineRunCommandPollerResponse is the response envelope for operations that asynchronously return a VirtualMachineRunCommand type. -type VirtualMachineRunCommandPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (VirtualMachineRunCommandResponse, error) +// DisksUpdateResult contains the result from method Disks.Update. +type DisksUpdateResult struct { + Disk +} +// GalleriesCreateOrUpdatePollerResponse contains the response from method Galleries.CreateOrUpdate. +type GalleriesCreateOrUpdatePollerResponse struct { // Poller contains an initialized poller. - Poller VirtualMachineRunCommandPoller + Poller *GalleriesCreateOrUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// VirtualMachineRunCommandResponse is the response envelope for operations that return a VirtualMachineRunCommand type. -type VirtualMachineRunCommandResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleriesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleriesCreateOrUpdateResponse, error) { + respType := GalleriesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Gallery) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleriesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *GalleriesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *GalleriesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleriesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &GalleriesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleriesCreateOrUpdateResponse contains the response from method Galleries.CreateOrUpdate. +type GalleriesCreateOrUpdateResponse struct { + GalleriesCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} + +// GalleriesCreateOrUpdateResult contains the result from method Galleries.CreateOrUpdate. +type GalleriesCreateOrUpdateResult struct { + Gallery +} + +// GalleriesDeletePollerResponse contains the response from method Galleries.Delete. +type GalleriesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *GalleriesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} - // Describes a Virtual Machine run command. - VirtualMachineRunCommand *VirtualMachineRunCommand +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleriesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleriesDeleteResponse, error) { + respType := GalleriesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleriesDeletePollerResponse from the provided client and resume token. +func (l *GalleriesDeletePollerResponse) Resume(ctx context.Context, client *GalleriesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleriesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &GalleriesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleriesDeleteResponse contains the response from method Galleries.Delete. +type GalleriesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// VirtualMachineRunCommandsListResultResponse is the response envelope for operations that return a VirtualMachineRunCommandsListResult type. -type VirtualMachineRunCommandsListResultResponse struct { +// GalleriesGetResponse contains the response from method Galleries.Get. +type GalleriesGetResponse struct { + GalleriesGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List run command operation response - VirtualMachineRunCommandsListResult *VirtualMachineRunCommandsListResult +// GalleriesGetResult contains the result from method Galleries.Get. +type GalleriesGetResult struct { + Gallery } -// VirtualMachineScaleSetExtensionListResultResponse is the response envelope for operations that return a VirtualMachineScaleSetExtensionListResult type. -type VirtualMachineScaleSetExtensionListResultResponse struct { +// GalleriesListByResourceGroupResponse contains the response from method Galleries.ListByResourceGroup. +type GalleriesListByResourceGroupResponse struct { + GalleriesListByResourceGroupResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} + +// GalleriesListByResourceGroupResult contains the result from method Galleries.ListByResourceGroup. +type GalleriesListByResourceGroupResult struct { + GalleryList +} - // The List VM scale set extension operation response. - VirtualMachineScaleSetExtensionListResult *VirtualMachineScaleSetExtensionListResult +// GalleriesListResponse contains the response from method Galleries.List. +type GalleriesListResponse struct { + GalleriesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// VirtualMachineScaleSetExtensionPollerResponse is the response envelope for operations that asynchronously return a VirtualMachineScaleSetExtension type. -type VirtualMachineScaleSetExtensionPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetExtensionResponse, error) +// GalleriesListResult contains the result from method Galleries.List. +type GalleriesListResult struct { + GalleryList +} +// GalleriesUpdatePollerResponse contains the response from method Galleries.Update. +type GalleriesUpdatePollerResponse struct { // Poller contains an initialized poller. - Poller VirtualMachineScaleSetExtensionPoller + Poller *GalleriesUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// VirtualMachineScaleSetExtensionResponse is the response envelope for operations that return a VirtualMachineScaleSetExtension type. -type VirtualMachineScaleSetExtensionResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleriesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleriesUpdateResponse, error) { + respType := GalleriesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Gallery) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleriesUpdatePollerResponse from the provided client and resume token. +func (l *GalleriesUpdatePollerResponse) Resume(ctx context.Context, client *GalleriesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleriesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &GalleriesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleriesUpdateResponse contains the response from method Galleries.Update. +type GalleriesUpdateResponse struct { + GalleriesUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} + +// GalleriesUpdateResult contains the result from method Galleries.Update. +type GalleriesUpdateResult struct { + Gallery +} + +// GalleryApplicationVersionsCreateOrUpdatePollerResponse contains the response from method GalleryApplicationVersions.CreateOrUpdate. +type GalleryApplicationVersionsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *GalleryApplicationVersionsCreateOrUpdatePoller - // Describes a Virtual Machine Scale Set Extension. - VirtualMachineScaleSetExtension *VirtualMachineScaleSetExtension + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// VirtualMachineScaleSetInstanceViewResponse is the response envelope for operations that return a VirtualMachineScaleSetInstanceView type. -type VirtualMachineScaleSetInstanceViewResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryApplicationVersionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationVersionsCreateOrUpdateResponse, error) { + respType := GalleryApplicationVersionsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryApplicationVersion) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryApplicationVersionsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *GalleryApplicationVersionsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *GalleryApplicationVersionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryApplicationVersionsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &GalleryApplicationVersionsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryApplicationVersionsCreateOrUpdateResponse contains the response from method GalleryApplicationVersions.CreateOrUpdate. +type GalleryApplicationVersionsCreateOrUpdateResponse struct { + GalleryApplicationVersionsCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The instance view of a virtual machine scale set. - VirtualMachineScaleSetInstanceView *VirtualMachineScaleSetInstanceView +// GalleryApplicationVersionsCreateOrUpdateResult contains the result from method GalleryApplicationVersions.CreateOrUpdate. +type GalleryApplicationVersionsCreateOrUpdateResult struct { + GalleryApplicationVersion } -// VirtualMachineScaleSetListOSUpgradeHistoryResponse is the response envelope for operations that return a VirtualMachineScaleSetListOSUpgradeHistory type. -type VirtualMachineScaleSetListOSUpgradeHistoryResponse struct { +// GalleryApplicationVersionsDeletePollerResponse contains the response from method GalleryApplicationVersions.Delete. +type GalleryApplicationVersionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *GalleryApplicationVersionsDeletePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // List of Virtual Machine Scale Set OS Upgrade History operation response. - VirtualMachineScaleSetListOSUpgradeHistory *VirtualMachineScaleSetListOSUpgradeHistory +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryApplicationVersionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationVersionsDeleteResponse, error) { + respType := GalleryApplicationVersionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryApplicationVersionsDeletePollerResponse from the provided client and resume token. +func (l *GalleryApplicationVersionsDeletePollerResponse) Resume(ctx context.Context, client *GalleryApplicationVersionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryApplicationVersionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &GalleryApplicationVersionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryApplicationVersionsDeleteResponse contains the response from method GalleryApplicationVersions.Delete. +type GalleryApplicationVersionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// VirtualMachineScaleSetListResultResponse is the response envelope for operations that return a VirtualMachineScaleSetListResult type. -type VirtualMachineScaleSetListResultResponse struct { +// GalleryApplicationVersionsGetResponse contains the response from method GalleryApplicationVersions.Get. +type GalleryApplicationVersionsGetResponse struct { + GalleryApplicationVersionsGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List Virtual Machine operation response. - VirtualMachineScaleSetListResult *VirtualMachineScaleSetListResult +// GalleryApplicationVersionsGetResult contains the result from method GalleryApplicationVersions.Get. +type GalleryApplicationVersionsGetResult struct { + GalleryApplicationVersion } -// VirtualMachineScaleSetListSKUsResultResponse is the response envelope for operations that return a VirtualMachineScaleSetListSKUsResult type. -type VirtualMachineScaleSetListSKUsResultResponse struct { +// GalleryApplicationVersionsListByGalleryApplicationResponse contains the response from method GalleryApplicationVersions.ListByGalleryApplication. +type GalleryApplicationVersionsListByGalleryApplicationResponse struct { + GalleryApplicationVersionsListByGalleryApplicationResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The Virtual Machine Scale Set List Skus operation response. - VirtualMachineScaleSetListSKUsResult *VirtualMachineScaleSetListSKUsResult +// GalleryApplicationVersionsListByGalleryApplicationResult contains the result from method GalleryApplicationVersions.ListByGalleryApplication. +type GalleryApplicationVersionsListByGalleryApplicationResult struct { + GalleryApplicationVersionList } -// VirtualMachineScaleSetListWithLinkResultResponse is the response envelope for operations that return a VirtualMachineScaleSetListWithLinkResult type. -type VirtualMachineScaleSetListWithLinkResultResponse struct { +// GalleryApplicationVersionsUpdatePollerResponse contains the response from method GalleryApplicationVersions.Update. +type GalleryApplicationVersionsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *GalleryApplicationVersionsUpdatePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List Virtual Machine operation response. - VirtualMachineScaleSetListWithLinkResult *VirtualMachineScaleSetListWithLinkResult +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryApplicationVersionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationVersionsUpdateResponse, error) { + respType := GalleryApplicationVersionsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryApplicationVersion) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryApplicationVersionsUpdatePollerResponse from the provided client and resume token. +func (l *GalleryApplicationVersionsUpdatePollerResponse) Resume(ctx context.Context, client *GalleryApplicationVersionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryApplicationVersionsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &GalleryApplicationVersionsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryApplicationVersionsUpdateResponse contains the response from method GalleryApplicationVersions.Update. +type GalleryApplicationVersionsUpdateResponse struct { + GalleryApplicationVersionsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// VirtualMachineScaleSetPollerResponse is the response envelope for operations that asynchronously return a VirtualMachineScaleSet type. -type VirtualMachineScaleSetPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetResponse, error) +// GalleryApplicationVersionsUpdateResult contains the result from method GalleryApplicationVersions.Update. +type GalleryApplicationVersionsUpdateResult struct { + GalleryApplicationVersion +} +// GalleryApplicationsCreateOrUpdatePollerResponse contains the response from method GalleryApplications.CreateOrUpdate. +type GalleryApplicationsCreateOrUpdatePollerResponse struct { // Poller contains an initialized poller. - Poller VirtualMachineScaleSetPoller + Poller *GalleryApplicationsCreateOrUpdatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// VirtualMachineScaleSetResponse is the response envelope for operations that return a VirtualMachineScaleSet type. -type VirtualMachineScaleSetResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryApplicationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationsCreateOrUpdateResponse, error) { + respType := GalleryApplicationsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryApplication) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryApplicationsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *GalleryApplicationsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *GalleryApplicationsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryApplicationsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &GalleryApplicationsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryApplicationsCreateOrUpdateResponse contains the response from method GalleryApplications.CreateOrUpdate. +type GalleryApplicationsCreateOrUpdateResponse struct { + GalleryApplicationsCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // Describes a Virtual Machine Scale Set. - VirtualMachineScaleSet *VirtualMachineScaleSet } -// VirtualMachineScaleSetVMExtensionPollerResponse is the response envelope for operations that asynchronously return a VirtualMachineScaleSetVMExtension -// type. -type VirtualMachineScaleSetVMExtensionPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetVMExtensionResponse, error) +// GalleryApplicationsCreateOrUpdateResult contains the result from method GalleryApplications.CreateOrUpdate. +type GalleryApplicationsCreateOrUpdateResult struct { + GalleryApplication +} +// GalleryApplicationsDeletePollerResponse contains the response from method GalleryApplications.Delete. +type GalleryApplicationsDeletePollerResponse struct { // Poller contains an initialized poller. - Poller VirtualMachineScaleSetVMExtensionPoller + Poller *GalleryApplicationsDeletePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// VirtualMachineScaleSetVMExtensionResponse is the response envelope for operations that return a VirtualMachineScaleSetVMExtension type. -type VirtualMachineScaleSetVMExtensionResponse struct { +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryApplicationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationsDeleteResponse, error) { + respType := GalleryApplicationsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryApplicationsDeletePollerResponse from the provided client and resume token. +func (l *GalleryApplicationsDeletePollerResponse) Resume(ctx context.Context, client *GalleryApplicationsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryApplicationsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &GalleryApplicationsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryApplicationsDeleteResponse contains the response from method GalleryApplications.Delete. +type GalleryApplicationsDeleteResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response - - // Describes a VMSS VM Extension. - VirtualMachineScaleSetVMExtension *VirtualMachineScaleSetVMExtension } -// VirtualMachineScaleSetVMExtensionsListResultResponse is the response envelope for operations that return a VirtualMachineScaleSetVMExtensionsListResult -// type. -type VirtualMachineScaleSetVMExtensionsListResultResponse struct { +// GalleryApplicationsGetResponse contains the response from method GalleryApplications.Get. +type GalleryApplicationsGetResponse struct { + GalleryApplicationsGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List VMSS VM Extension operation response - VirtualMachineScaleSetVMExtensionsListResult *VirtualMachineScaleSetVMExtensionsListResult +// GalleryApplicationsGetResult contains the result from method GalleryApplications.Get. +type GalleryApplicationsGetResult struct { + GalleryApplication } -// VirtualMachineScaleSetVMInstanceViewResponse is the response envelope for operations that return a VirtualMachineScaleSetVMInstanceView type. -type VirtualMachineScaleSetVMInstanceViewResponse struct { +// GalleryApplicationsListByGalleryResponse contains the response from method GalleryApplications.ListByGallery. +type GalleryApplicationsListByGalleryResponse struct { + GalleryApplicationsListByGalleryResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The instance view of a virtual machine scale set VM. - VirtualMachineScaleSetVMInstanceView *VirtualMachineScaleSetVMInstanceView +// GalleryApplicationsListByGalleryResult contains the result from method GalleryApplications.ListByGallery. +type GalleryApplicationsListByGalleryResult struct { + GalleryApplicationList } -// VirtualMachineScaleSetVMListResultResponse is the response envelope for operations that return a VirtualMachineScaleSetVMListResult type. -type VirtualMachineScaleSetVMListResultResponse struct { +// GalleryApplicationsUpdatePollerResponse contains the response from method GalleryApplications.Update. +type GalleryApplicationsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *GalleryApplicationsUpdatePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // The List Virtual Machine Scale Set VMs operation response. - VirtualMachineScaleSetVMListResult *VirtualMachineScaleSetVMListResult +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryApplicationsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationsUpdateResponse, error) { + respType := GalleryApplicationsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryApplication) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryApplicationsUpdatePollerResponse from the provided client and resume token. +func (l *GalleryApplicationsUpdatePollerResponse) Resume(ctx context.Context, client *GalleryApplicationsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryApplicationsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &GalleryApplicationsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryApplicationsUpdateResponse contains the response from method GalleryApplications.Update. +type GalleryApplicationsUpdateResponse struct { + GalleryApplicationsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// VirtualMachineScaleSetVMPollerResponse is the response envelope for operations that asynchronously return a VirtualMachineScaleSetVM type. -type VirtualMachineScaleSetVMPollerResponse struct { - // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received - PollUntilDone func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetVMResponse, error) +// GalleryApplicationsUpdateResult contains the result from method GalleryApplications.Update. +type GalleryApplicationsUpdateResult struct { + GalleryApplication +} +// GalleryImageVersionsCreateOrUpdatePollerResponse contains the response from method GalleryImageVersions.CreateOrUpdate. +type GalleryImageVersionsCreateOrUpdatePollerResponse struct { // Poller contains an initialized poller. - Poller VirtualMachineScaleSetVMPoller + Poller *GalleryImageVersionsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryImageVersionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImageVersionsCreateOrUpdateResponse, error) { + respType := GalleryImageVersionsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryImageVersion) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryImageVersionsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *GalleryImageVersionsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *GalleryImageVersionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryImageVersionsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &GalleryImageVersionsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryImageVersionsCreateOrUpdateResponse contains the response from method GalleryImageVersions.CreateOrUpdate. +type GalleryImageVersionsCreateOrUpdateResponse struct { + GalleryImageVersionsCreateOrUpdateResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// VirtualMachineScaleSetVMResponse is the response envelope for operations that return a VirtualMachineScaleSetVM type. -type VirtualMachineScaleSetVMResponse struct { +// GalleryImageVersionsCreateOrUpdateResult contains the result from method GalleryImageVersions.CreateOrUpdate. +type GalleryImageVersionsCreateOrUpdateResult struct { + GalleryImageVersion +} + +// GalleryImageVersionsDeletePollerResponse contains the response from method GalleryImageVersions.Delete. +type GalleryImageVersionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *GalleryImageVersionsDeletePoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} - // Describes a virtual machine scale set virtual machine. - VirtualMachineScaleSetVM *VirtualMachineScaleSetVM +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryImageVersionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImageVersionsDeleteResponse, error) { + respType := GalleryImageVersionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryImageVersionsDeletePollerResponse from the provided client and resume token. +func (l *GalleryImageVersionsDeletePollerResponse) Resume(ctx context.Context, client *GalleryImageVersionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryImageVersionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &GalleryImageVersionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryImageVersionsDeleteResponse contains the response from method GalleryImageVersions.Delete. +type GalleryImageVersionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response } -// VirtualMachineSizeListResultResponse is the response envelope for operations that return a VirtualMachineSizeListResult type. -type VirtualMachineSizeListResultResponse struct { +// GalleryImageVersionsGetResponse contains the response from method GalleryImageVersions.Get. +type GalleryImageVersionsGetResponse struct { + GalleryImageVersionsGetResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response +} + +// GalleryImageVersionsGetResult contains the result from method GalleryImageVersions.Get. +type GalleryImageVersionsGetResult struct { + GalleryImageVersion +} + +// GalleryImageVersionsListByGalleryImageResponse contains the response from method GalleryImageVersions.ListByGalleryImage. +type GalleryImageVersionsListByGalleryImageResponse struct { + GalleryImageVersionsListByGalleryImageResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// GalleryImageVersionsListByGalleryImageResult contains the result from method GalleryImageVersions.ListByGalleryImage. +type GalleryImageVersionsListByGalleryImageResult struct { + GalleryImageVersionList +} + +// GalleryImageVersionsUpdatePollerResponse contains the response from method GalleryImageVersions.Update. +type GalleryImageVersionsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *GalleryImageVersionsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryImageVersionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImageVersionsUpdateResponse, error) { + respType := GalleryImageVersionsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryImageVersion) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryImageVersionsUpdatePollerResponse from the provided client and resume token. +func (l *GalleryImageVersionsUpdatePollerResponse) Resume(ctx context.Context, client *GalleryImageVersionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryImageVersionsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &GalleryImageVersionsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryImageVersionsUpdateResponse contains the response from method GalleryImageVersions.Update. +type GalleryImageVersionsUpdateResponse struct { + GalleryImageVersionsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// GalleryImageVersionsUpdateResult contains the result from method GalleryImageVersions.Update. +type GalleryImageVersionsUpdateResult struct { + GalleryImageVersion +} + +// GalleryImagesCreateOrUpdatePollerResponse contains the response from method GalleryImages.CreateOrUpdate. +type GalleryImagesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *GalleryImagesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryImagesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImagesCreateOrUpdateResponse, error) { + respType := GalleryImagesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryImage) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryImagesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *GalleryImagesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *GalleryImagesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryImagesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &GalleryImagesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryImagesCreateOrUpdateResponse contains the response from method GalleryImages.CreateOrUpdate. +type GalleryImagesCreateOrUpdateResponse struct { + GalleryImagesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// GalleryImagesCreateOrUpdateResult contains the result from method GalleryImages.CreateOrUpdate. +type GalleryImagesCreateOrUpdateResult struct { + GalleryImage +} + +// GalleryImagesDeletePollerResponse contains the response from method GalleryImages.Delete. +type GalleryImagesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *GalleryImagesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryImagesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImagesDeleteResponse, error) { + respType := GalleryImagesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryImagesDeletePollerResponse from the provided client and resume token. +func (l *GalleryImagesDeletePollerResponse) Resume(ctx context.Context, client *GalleryImagesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryImagesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &GalleryImagesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryImagesDeleteResponse contains the response from method GalleryImages.Delete. +type GalleryImagesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// GalleryImagesGetResponse contains the response from method GalleryImages.Get. +type GalleryImagesGetResponse struct { + GalleryImagesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// GalleryImagesGetResult contains the result from method GalleryImages.Get. +type GalleryImagesGetResult struct { + GalleryImage +} + +// GalleryImagesListByGalleryResponse contains the response from method GalleryImages.ListByGallery. +type GalleryImagesListByGalleryResponse struct { + GalleryImagesListByGalleryResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// GalleryImagesListByGalleryResult contains the result from method GalleryImages.ListByGallery. +type GalleryImagesListByGalleryResult struct { + GalleryImageList +} + +// GalleryImagesUpdatePollerResponse contains the response from method GalleryImages.Update. +type GalleryImagesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *GalleryImagesUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GalleryImagesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImagesUpdateResponse, error) { + respType := GalleryImagesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryImage) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GalleryImagesUpdatePollerResponse from the provided client and resume token. +func (l *GalleryImagesUpdatePollerResponse) Resume(ctx context.Context, client *GalleryImagesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GalleryImagesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &GalleryImagesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GalleryImagesUpdateResponse contains the response from method GalleryImages.Update. +type GalleryImagesUpdateResponse struct { + GalleryImagesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// GalleryImagesUpdateResult contains the result from method GalleryImages.Update. +type GalleryImagesUpdateResult struct { + GalleryImage +} + +// GallerySharingProfileUpdatePollerResponse contains the response from method GallerySharingProfile.Update. +type GallerySharingProfileUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *GallerySharingProfileUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l GallerySharingProfileUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GallerySharingProfileUpdateResponse, error) { + respType := GallerySharingProfileUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SharingUpdate) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a GallerySharingProfileUpdatePollerResponse from the provided client and resume token. +func (l *GallerySharingProfileUpdatePollerResponse) Resume(ctx context.Context, client *GallerySharingProfileClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("GallerySharingProfileClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &GallerySharingProfileUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// GallerySharingProfileUpdateResponse contains the response from method GallerySharingProfile.Update. +type GallerySharingProfileUpdateResponse struct { + GallerySharingProfileUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// GallerySharingProfileUpdateResult contains the result from method GallerySharingProfile.Update. +type GallerySharingProfileUpdateResult struct { + SharingUpdate +} + +// ImagesCreateOrUpdatePollerResponse contains the response from method Images.CreateOrUpdate. +type ImagesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *ImagesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l ImagesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ImagesCreateOrUpdateResponse, error) { + respType := ImagesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Image) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ImagesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *ImagesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *ImagesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ImagesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &ImagesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ImagesCreateOrUpdateResponse contains the response from method Images.CreateOrUpdate. +type ImagesCreateOrUpdateResponse struct { + ImagesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ImagesCreateOrUpdateResult contains the result from method Images.CreateOrUpdate. +type ImagesCreateOrUpdateResult struct { + Image +} + +// ImagesDeletePollerResponse contains the response from method Images.Delete. +type ImagesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *ImagesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l ImagesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ImagesDeleteResponse, error) { + respType := ImagesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ImagesDeletePollerResponse from the provided client and resume token. +func (l *ImagesDeletePollerResponse) Resume(ctx context.Context, client *ImagesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ImagesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &ImagesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ImagesDeleteResponse contains the response from method Images.Delete. +type ImagesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ImagesGetResponse contains the response from method Images.Get. +type ImagesGetResponse struct { + ImagesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ImagesGetResult contains the result from method Images.Get. +type ImagesGetResult struct { + Image +} + +// ImagesListByResourceGroupResponse contains the response from method Images.ListByResourceGroup. +type ImagesListByResourceGroupResponse struct { + ImagesListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ImagesListByResourceGroupResult contains the result from method Images.ListByResourceGroup. +type ImagesListByResourceGroupResult struct { + ImageListResult +} + +// ImagesListResponse contains the response from method Images.List. +type ImagesListResponse struct { + ImagesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ImagesListResult contains the result from method Images.List. +type ImagesListResult struct { + ImageListResult +} + +// ImagesUpdatePollerResponse contains the response from method Images.Update. +type ImagesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *ImagesUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l ImagesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ImagesUpdateResponse, error) { + respType := ImagesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Image) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ImagesUpdatePollerResponse from the provided client and resume token. +func (l *ImagesUpdatePollerResponse) Resume(ctx context.Context, client *ImagesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ImagesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &ImagesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ImagesUpdateResponse contains the response from method Images.Update. +type ImagesUpdateResponse struct { + ImagesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ImagesUpdateResult contains the result from method Images.Update. +type ImagesUpdateResult struct { + Image +} + +// LogAnalyticsExportRequestRateByIntervalPollerResponse contains the response from method LogAnalytics.ExportRequestRateByInterval. +type LogAnalyticsExportRequestRateByIntervalPollerResponse struct { + // Poller contains an initialized poller. + Poller *LogAnalyticsExportRequestRateByIntervalPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LogAnalyticsExportRequestRateByIntervalPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LogAnalyticsExportRequestRateByIntervalResponse, error) { + respType := LogAnalyticsExportRequestRateByIntervalResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LogAnalyticsOperationResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LogAnalyticsExportRequestRateByIntervalPollerResponse from the provided client and resume token. +func (l *LogAnalyticsExportRequestRateByIntervalPollerResponse) Resume(ctx context.Context, client *LogAnalyticsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LogAnalyticsClient.ExportRequestRateByInterval", token, client.pl, client.exportRequestRateByIntervalHandleError) + if err != nil { + return err + } + poller := &LogAnalyticsExportRequestRateByIntervalPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LogAnalyticsExportRequestRateByIntervalResponse contains the response from method LogAnalytics.ExportRequestRateByInterval. +type LogAnalyticsExportRequestRateByIntervalResponse struct { + LogAnalyticsExportRequestRateByIntervalResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LogAnalyticsExportRequestRateByIntervalResult contains the result from method LogAnalytics.ExportRequestRateByInterval. +type LogAnalyticsExportRequestRateByIntervalResult struct { + LogAnalyticsOperationResult +} + +// LogAnalyticsExportThrottledRequestsPollerResponse contains the response from method LogAnalytics.ExportThrottledRequests. +type LogAnalyticsExportThrottledRequestsPollerResponse struct { + // Poller contains an initialized poller. + Poller *LogAnalyticsExportThrottledRequestsPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l LogAnalyticsExportThrottledRequestsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LogAnalyticsExportThrottledRequestsResponse, error) { + respType := LogAnalyticsExportThrottledRequestsResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LogAnalyticsOperationResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LogAnalyticsExportThrottledRequestsPollerResponse from the provided client and resume token. +func (l *LogAnalyticsExportThrottledRequestsPollerResponse) Resume(ctx context.Context, client *LogAnalyticsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LogAnalyticsClient.ExportThrottledRequests", token, client.pl, client.exportThrottledRequestsHandleError) + if err != nil { + return err + } + poller := &LogAnalyticsExportThrottledRequestsPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LogAnalyticsExportThrottledRequestsResponse contains the response from method LogAnalytics.ExportThrottledRequests. +type LogAnalyticsExportThrottledRequestsResponse struct { + LogAnalyticsExportThrottledRequestsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LogAnalyticsExportThrottledRequestsResult contains the result from method LogAnalytics.ExportThrottledRequests. +type LogAnalyticsExportThrottledRequestsResult struct { + LogAnalyticsOperationResult +} + +// OperationsListResponse contains the response from method Operations.List. +type OperationsListResponse struct { + OperationsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsListResult contains the result from method Operations.List. +type OperationsListResult struct { + ComputeOperationListResult +} + +// ProximityPlacementGroupsCreateOrUpdateResponse contains the response from method ProximityPlacementGroups.CreateOrUpdate. +type ProximityPlacementGroupsCreateOrUpdateResponse struct { + ProximityPlacementGroupsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ProximityPlacementGroupsCreateOrUpdateResult contains the result from method ProximityPlacementGroups.CreateOrUpdate. +type ProximityPlacementGroupsCreateOrUpdateResult struct { + ProximityPlacementGroup +} + +// ProximityPlacementGroupsDeleteResponse contains the response from method ProximityPlacementGroups.Delete. +type ProximityPlacementGroupsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ProximityPlacementGroupsGetResponse contains the response from method ProximityPlacementGroups.Get. +type ProximityPlacementGroupsGetResponse struct { + ProximityPlacementGroupsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ProximityPlacementGroupsGetResult contains the result from method ProximityPlacementGroups.Get. +type ProximityPlacementGroupsGetResult struct { + ProximityPlacementGroup +} + +// ProximityPlacementGroupsListByResourceGroupResponse contains the response from method ProximityPlacementGroups.ListByResourceGroup. +type ProximityPlacementGroupsListByResourceGroupResponse struct { + ProximityPlacementGroupsListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ProximityPlacementGroupsListByResourceGroupResult contains the result from method ProximityPlacementGroups.ListByResourceGroup. +type ProximityPlacementGroupsListByResourceGroupResult struct { + ProximityPlacementGroupListResult +} + +// ProximityPlacementGroupsListBySubscriptionResponse contains the response from method ProximityPlacementGroups.ListBySubscription. +type ProximityPlacementGroupsListBySubscriptionResponse struct { + ProximityPlacementGroupsListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ProximityPlacementGroupsListBySubscriptionResult contains the result from method ProximityPlacementGroups.ListBySubscription. +type ProximityPlacementGroupsListBySubscriptionResult struct { + ProximityPlacementGroupListResult +} + +// ProximityPlacementGroupsUpdateResponse contains the response from method ProximityPlacementGroups.Update. +type ProximityPlacementGroupsUpdateResponse struct { + ProximityPlacementGroupsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ProximityPlacementGroupsUpdateResult contains the result from method ProximityPlacementGroups.Update. +type ProximityPlacementGroupsUpdateResult struct { + ProximityPlacementGroup +} + +// ResourceSKUsListResponse contains the response from method ResourceSKUs.List. +type ResourceSKUsListResponse struct { + ResourceSKUsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ResourceSKUsListResult contains the result from method ResourceSKUs.List. +type ResourceSKUsListResult struct { + ResourceSKUsResult +} + +// RestorePointCollectionsCreateOrUpdateResponse contains the response from method RestorePointCollections.CreateOrUpdate. +type RestorePointCollectionsCreateOrUpdateResponse struct { + RestorePointCollectionsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RestorePointCollectionsCreateOrUpdateResult contains the result from method RestorePointCollections.CreateOrUpdate. +type RestorePointCollectionsCreateOrUpdateResult struct { + RestorePointCollection +} + +// RestorePointCollectionsDeletePollerResponse contains the response from method RestorePointCollections.Delete. +type RestorePointCollectionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *RestorePointCollectionsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l RestorePointCollectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RestorePointCollectionsDeleteResponse, error) { + respType := RestorePointCollectionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a RestorePointCollectionsDeletePollerResponse from the provided client and resume token. +func (l *RestorePointCollectionsDeletePollerResponse) Resume(ctx context.Context, client *RestorePointCollectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("RestorePointCollectionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &RestorePointCollectionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// RestorePointCollectionsDeleteResponse contains the response from method RestorePointCollections.Delete. +type RestorePointCollectionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RestorePointCollectionsGetResponse contains the response from method RestorePointCollections.Get. +type RestorePointCollectionsGetResponse struct { + RestorePointCollectionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RestorePointCollectionsGetResult contains the result from method RestorePointCollections.Get. +type RestorePointCollectionsGetResult struct { + RestorePointCollection +} + +// RestorePointCollectionsListAllResponse contains the response from method RestorePointCollections.ListAll. +type RestorePointCollectionsListAllResponse struct { + RestorePointCollectionsListAllResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RestorePointCollectionsListAllResult contains the result from method RestorePointCollections.ListAll. +type RestorePointCollectionsListAllResult struct { + RestorePointCollectionListResult +} + +// RestorePointCollectionsListResponse contains the response from method RestorePointCollections.List. +type RestorePointCollectionsListResponse struct { + RestorePointCollectionsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RestorePointCollectionsListResult contains the result from method RestorePointCollections.List. +type RestorePointCollectionsListResult struct { + RestorePointCollectionListResult +} + +// RestorePointCollectionsUpdateResponse contains the response from method RestorePointCollections.Update. +type RestorePointCollectionsUpdateResponse struct { + RestorePointCollectionsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RestorePointCollectionsUpdateResult contains the result from method RestorePointCollections.Update. +type RestorePointCollectionsUpdateResult struct { + RestorePointCollection +} + +// RestorePointsCreatePollerResponse contains the response from method RestorePoints.Create. +type RestorePointsCreatePollerResponse struct { + // Poller contains an initialized poller. + Poller *RestorePointsCreatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l RestorePointsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RestorePointsCreateResponse, error) { + respType := RestorePointsCreateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RestorePoint) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a RestorePointsCreatePollerResponse from the provided client and resume token. +func (l *RestorePointsCreatePollerResponse) Resume(ctx context.Context, client *RestorePointsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("RestorePointsClient.Create", token, client.pl, client.createHandleError) + if err != nil { + return err + } + poller := &RestorePointsCreatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// RestorePointsCreateResponse contains the response from method RestorePoints.Create. +type RestorePointsCreateResponse struct { + RestorePointsCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RestorePointsCreateResult contains the result from method RestorePoints.Create. +type RestorePointsCreateResult struct { + RestorePoint +} + +// RestorePointsDeletePollerResponse contains the response from method RestorePoints.Delete. +type RestorePointsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *RestorePointsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l RestorePointsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RestorePointsDeleteResponse, error) { + respType := RestorePointsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a RestorePointsDeletePollerResponse from the provided client and resume token. +func (l *RestorePointsDeletePollerResponse) Resume(ctx context.Context, client *RestorePointsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("RestorePointsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &RestorePointsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// RestorePointsDeleteResponse contains the response from method RestorePoints.Delete. +type RestorePointsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RestorePointsGetResponse contains the response from method RestorePoints.Get. +type RestorePointsGetResponse struct { + RestorePointsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RestorePointsGetResult contains the result from method RestorePoints.Get. +type RestorePointsGetResult struct { + RestorePoint +} + +// SSHPublicKeysCreateResponse contains the response from method SSHPublicKeys.Create. +type SSHPublicKeysCreateResponse struct { + SSHPublicKeysCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SSHPublicKeysCreateResult contains the result from method SSHPublicKeys.Create. +type SSHPublicKeysCreateResult struct { + SSHPublicKeyResource +} + +// SSHPublicKeysDeleteResponse contains the response from method SSHPublicKeys.Delete. +type SSHPublicKeysDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SSHPublicKeysGenerateKeyPairResponse contains the response from method SSHPublicKeys.GenerateKeyPair. +type SSHPublicKeysGenerateKeyPairResponse struct { + SSHPublicKeysGenerateKeyPairResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SSHPublicKeysGenerateKeyPairResult contains the result from method SSHPublicKeys.GenerateKeyPair. +type SSHPublicKeysGenerateKeyPairResult struct { + SSHPublicKeyGenerateKeyPairResult +} + +// SSHPublicKeysGetResponse contains the response from method SSHPublicKeys.Get. +type SSHPublicKeysGetResponse struct { + SSHPublicKeysGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SSHPublicKeysGetResult contains the result from method SSHPublicKeys.Get. +type SSHPublicKeysGetResult struct { + SSHPublicKeyResource +} + +// SSHPublicKeysListByResourceGroupResponse contains the response from method SSHPublicKeys.ListByResourceGroup. +type SSHPublicKeysListByResourceGroupResponse struct { + SSHPublicKeysListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SSHPublicKeysListByResourceGroupResult contains the result from method SSHPublicKeys.ListByResourceGroup. +type SSHPublicKeysListByResourceGroupResult struct { + SSHPublicKeysGroupListResult +} + +// SSHPublicKeysListBySubscriptionResponse contains the response from method SSHPublicKeys.ListBySubscription. +type SSHPublicKeysListBySubscriptionResponse struct { + SSHPublicKeysListBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SSHPublicKeysListBySubscriptionResult contains the result from method SSHPublicKeys.ListBySubscription. +type SSHPublicKeysListBySubscriptionResult struct { + SSHPublicKeysGroupListResult +} + +// SSHPublicKeysUpdateResponse contains the response from method SSHPublicKeys.Update. +type SSHPublicKeysUpdateResponse struct { + SSHPublicKeysUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SSHPublicKeysUpdateResult contains the result from method SSHPublicKeys.Update. +type SSHPublicKeysUpdateResult struct { + SSHPublicKeyResource +} + +// SharedGalleriesGetResponse contains the response from method SharedGalleries.Get. +type SharedGalleriesGetResponse struct { + SharedGalleriesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SharedGalleriesGetResult contains the result from method SharedGalleries.Get. +type SharedGalleriesGetResult struct { + SharedGallery +} + +// SharedGalleriesListResponse contains the response from method SharedGalleries.List. +type SharedGalleriesListResponse struct { + SharedGalleriesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SharedGalleriesListResult contains the result from method SharedGalleries.List. +type SharedGalleriesListResult struct { + SharedGalleryList +} + +// SharedGalleryImageVersionsGetResponse contains the response from method SharedGalleryImageVersions.Get. +type SharedGalleryImageVersionsGetResponse struct { + SharedGalleryImageVersionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SharedGalleryImageVersionsGetResult contains the result from method SharedGalleryImageVersions.Get. +type SharedGalleryImageVersionsGetResult struct { + SharedGalleryImageVersion +} + +// SharedGalleryImageVersionsListResponse contains the response from method SharedGalleryImageVersions.List. +type SharedGalleryImageVersionsListResponse struct { + SharedGalleryImageVersionsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SharedGalleryImageVersionsListResult contains the result from method SharedGalleryImageVersions.List. +type SharedGalleryImageVersionsListResult struct { + SharedGalleryImageVersionList +} + +// SharedGalleryImagesGetResponse contains the response from method SharedGalleryImages.Get. +type SharedGalleryImagesGetResponse struct { + SharedGalleryImagesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SharedGalleryImagesGetResult contains the result from method SharedGalleryImages.Get. +type SharedGalleryImagesGetResult struct { + SharedGalleryImage +} + +// SharedGalleryImagesListResponse contains the response from method SharedGalleryImages.List. +type SharedGalleryImagesListResponse struct { + SharedGalleryImagesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SharedGalleryImagesListResult contains the result from method SharedGalleryImages.List. +type SharedGalleryImagesListResult struct { + SharedGalleryImageList +} + +// SnapshotsCreateOrUpdatePollerResponse contains the response from method Snapshots.CreateOrUpdate. +type SnapshotsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *SnapshotsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l SnapshotsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsCreateOrUpdateResponse, error) { + respType := SnapshotsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Snapshot) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SnapshotsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *SnapshotsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *SnapshotsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SnapshotsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &SnapshotsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SnapshotsCreateOrUpdateResponse contains the response from method Snapshots.CreateOrUpdate. +type SnapshotsCreateOrUpdateResponse struct { + SnapshotsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsCreateOrUpdateResult contains the result from method Snapshots.CreateOrUpdate. +type SnapshotsCreateOrUpdateResult struct { + Snapshot +} + +// SnapshotsDeletePollerResponse contains the response from method Snapshots.Delete. +type SnapshotsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *SnapshotsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l SnapshotsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsDeleteResponse, error) { + respType := SnapshotsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SnapshotsDeletePollerResponse from the provided client and resume token. +func (l *SnapshotsDeletePollerResponse) Resume(ctx context.Context, client *SnapshotsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SnapshotsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &SnapshotsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SnapshotsDeleteResponse contains the response from method Snapshots.Delete. +type SnapshotsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsGetResponse contains the response from method Snapshots.Get. +type SnapshotsGetResponse struct { + SnapshotsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsGetResult contains the result from method Snapshots.Get. +type SnapshotsGetResult struct { + Snapshot +} + +// SnapshotsGrantAccessPollerResponse contains the response from method Snapshots.GrantAccess. +type SnapshotsGrantAccessPollerResponse struct { + // Poller contains an initialized poller. + Poller *SnapshotsGrantAccessPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l SnapshotsGrantAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsGrantAccessResponse, error) { + respType := SnapshotsGrantAccessResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AccessURI) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SnapshotsGrantAccessPollerResponse from the provided client and resume token. +func (l *SnapshotsGrantAccessPollerResponse) Resume(ctx context.Context, client *SnapshotsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SnapshotsClient.GrantAccess", token, client.pl, client.grantAccessHandleError) + if err != nil { + return err + } + poller := &SnapshotsGrantAccessPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SnapshotsGrantAccessResponse contains the response from method Snapshots.GrantAccess. +type SnapshotsGrantAccessResponse struct { + SnapshotsGrantAccessResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsGrantAccessResult contains the result from method Snapshots.GrantAccess. +type SnapshotsGrantAccessResult struct { + AccessURI +} + +// SnapshotsListByResourceGroupResponse contains the response from method Snapshots.ListByResourceGroup. +type SnapshotsListByResourceGroupResponse struct { + SnapshotsListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsListByResourceGroupResult contains the result from method Snapshots.ListByResourceGroup. +type SnapshotsListByResourceGroupResult struct { + SnapshotList +} + +// SnapshotsListResponse contains the response from method Snapshots.List. +type SnapshotsListResponse struct { + SnapshotsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsListResult contains the result from method Snapshots.List. +type SnapshotsListResult struct { + SnapshotList +} + +// SnapshotsRevokeAccessPollerResponse contains the response from method Snapshots.RevokeAccess. +type SnapshotsRevokeAccessPollerResponse struct { + // Poller contains an initialized poller. + Poller *SnapshotsRevokeAccessPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l SnapshotsRevokeAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsRevokeAccessResponse, error) { + respType := SnapshotsRevokeAccessResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SnapshotsRevokeAccessPollerResponse from the provided client and resume token. +func (l *SnapshotsRevokeAccessPollerResponse) Resume(ctx context.Context, client *SnapshotsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SnapshotsClient.RevokeAccess", token, client.pl, client.revokeAccessHandleError) + if err != nil { + return err + } + poller := &SnapshotsRevokeAccessPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SnapshotsRevokeAccessResponse contains the response from method Snapshots.RevokeAccess. +type SnapshotsRevokeAccessResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsUpdatePollerResponse contains the response from method Snapshots.Update. +type SnapshotsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *SnapshotsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l SnapshotsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsUpdateResponse, error) { + respType := SnapshotsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Snapshot) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a SnapshotsUpdatePollerResponse from the provided client and resume token. +func (l *SnapshotsUpdatePollerResponse) Resume(ctx context.Context, client *SnapshotsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("SnapshotsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &SnapshotsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// SnapshotsUpdateResponse contains the response from method Snapshots.Update. +type SnapshotsUpdateResponse struct { + SnapshotsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SnapshotsUpdateResult contains the result from method Snapshots.Update. +type SnapshotsUpdateResult struct { + Snapshot +} + +// UsageListResponse contains the response from method Usage.List. +type UsageListResponse struct { + UsageListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// UsageListResult contains the result from method Usage.List. +type UsageListResult struct { + ListUsagesResult +} + +// VirtualMachineExtensionImagesGetResponse contains the response from method VirtualMachineExtensionImages.Get. +type VirtualMachineExtensionImagesGetResponse struct { + VirtualMachineExtensionImagesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineExtensionImagesGetResult contains the result from method VirtualMachineExtensionImages.Get. +type VirtualMachineExtensionImagesGetResult struct { + VirtualMachineExtensionImage +} + +// VirtualMachineExtensionImagesListTypesResponse contains the response from method VirtualMachineExtensionImages.ListTypes. +type VirtualMachineExtensionImagesListTypesResponse struct { + VirtualMachineExtensionImagesListTypesResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineExtensionImagesListTypesResult contains the result from method VirtualMachineExtensionImages.ListTypes. +type VirtualMachineExtensionImagesListTypesResult struct { + // Array of VirtualMachineExtensionImage + VirtualMachineExtensionImageArray []*VirtualMachineExtensionImage +} + +// VirtualMachineExtensionImagesListVersionsResponse contains the response from method VirtualMachineExtensionImages.ListVersions. +type VirtualMachineExtensionImagesListVersionsResponse struct { + VirtualMachineExtensionImagesListVersionsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineExtensionImagesListVersionsResult contains the result from method VirtualMachineExtensionImages.ListVersions. +type VirtualMachineExtensionImagesListVersionsResult struct { + // Array of VirtualMachineExtensionImage + VirtualMachineExtensionImageArray []*VirtualMachineExtensionImage +} + +// VirtualMachineExtensionsCreateOrUpdatePollerResponse contains the response from method VirtualMachineExtensions.CreateOrUpdate. +type VirtualMachineExtensionsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineExtensionsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineExtensionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineExtensionsCreateOrUpdateResponse, error) { + respType := VirtualMachineExtensionsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineExtension) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineExtensionsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineExtensionsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineExtensionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineExtensionsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineExtensionsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineExtensionsCreateOrUpdateResponse contains the response from method VirtualMachineExtensions.CreateOrUpdate. +type VirtualMachineExtensionsCreateOrUpdateResponse struct { + VirtualMachineExtensionsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineExtensionsCreateOrUpdateResult contains the result from method VirtualMachineExtensions.CreateOrUpdate. +type VirtualMachineExtensionsCreateOrUpdateResult struct { + VirtualMachineExtension +} + +// VirtualMachineExtensionsDeletePollerResponse contains the response from method VirtualMachineExtensions.Delete. +type VirtualMachineExtensionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineExtensionsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineExtensionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineExtensionsDeleteResponse, error) { + respType := VirtualMachineExtensionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineExtensionsDeletePollerResponse from the provided client and resume token. +func (l *VirtualMachineExtensionsDeletePollerResponse) Resume(ctx context.Context, client *VirtualMachineExtensionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineExtensionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VirtualMachineExtensionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineExtensionsDeleteResponse contains the response from method VirtualMachineExtensions.Delete. +type VirtualMachineExtensionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineExtensionsGetResponse contains the response from method VirtualMachineExtensions.Get. +type VirtualMachineExtensionsGetResponse struct { + VirtualMachineExtensionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineExtensionsGetResult contains the result from method VirtualMachineExtensions.Get. +type VirtualMachineExtensionsGetResult struct { + VirtualMachineExtension +} + +// VirtualMachineExtensionsListResponse contains the response from method VirtualMachineExtensions.List. +type VirtualMachineExtensionsListResponse struct { + VirtualMachineExtensionsListResultEnvelope + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineExtensionsListResultEnvelope contains the result from method VirtualMachineExtensions.List. +type VirtualMachineExtensionsListResultEnvelope struct { + VirtualMachineExtensionsListResult +} + +// VirtualMachineExtensionsUpdatePollerResponse contains the response from method VirtualMachineExtensions.Update. +type VirtualMachineExtensionsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineExtensionsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineExtensionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineExtensionsUpdateResponse, error) { + respType := VirtualMachineExtensionsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineExtension) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineExtensionsUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineExtensionsUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineExtensionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineExtensionsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineExtensionsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineExtensionsUpdateResponse contains the response from method VirtualMachineExtensions.Update. +type VirtualMachineExtensionsUpdateResponse struct { + VirtualMachineExtensionsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineExtensionsUpdateResult contains the result from method VirtualMachineExtensions.Update. +type VirtualMachineExtensionsUpdateResult struct { + VirtualMachineExtension +} + +// VirtualMachineImagesEdgeZoneGetResponse contains the response from method VirtualMachineImagesEdgeZone.Get. +type VirtualMachineImagesEdgeZoneGetResponse struct { + VirtualMachineImagesEdgeZoneGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineImagesEdgeZoneGetResult contains the result from method VirtualMachineImagesEdgeZone.Get. +type VirtualMachineImagesEdgeZoneGetResult struct { + VirtualMachineImage +} + +// VirtualMachineImagesEdgeZoneListOffersResponse contains the response from method VirtualMachineImagesEdgeZone.ListOffers. +type VirtualMachineImagesEdgeZoneListOffersResponse struct { + VirtualMachineImagesEdgeZoneListOffersResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineImagesEdgeZoneListOffersResult contains the result from method VirtualMachineImagesEdgeZone.ListOffers. +type VirtualMachineImagesEdgeZoneListOffersResult struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesEdgeZoneListPublishersResponse contains the response from method VirtualMachineImagesEdgeZone.ListPublishers. +type VirtualMachineImagesEdgeZoneListPublishersResponse struct { + VirtualMachineImagesEdgeZoneListPublishersResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineImagesEdgeZoneListPublishersResult contains the result from method VirtualMachineImagesEdgeZone.ListPublishers. +type VirtualMachineImagesEdgeZoneListPublishersResult struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesEdgeZoneListResponse contains the response from method VirtualMachineImagesEdgeZone.List. +type VirtualMachineImagesEdgeZoneListResponse struct { + VirtualMachineImagesEdgeZoneListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineImagesEdgeZoneListResult contains the result from method VirtualMachineImagesEdgeZone.List. +type VirtualMachineImagesEdgeZoneListResult struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesEdgeZoneListSKUsResponse contains the response from method VirtualMachineImagesEdgeZone.ListSKUs. +type VirtualMachineImagesEdgeZoneListSKUsResponse struct { + VirtualMachineImagesEdgeZoneListSKUsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineImagesEdgeZoneListSKUsResult contains the result from method VirtualMachineImagesEdgeZone.ListSKUs. +type VirtualMachineImagesEdgeZoneListSKUsResult struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesGetResponse contains the response from method VirtualMachineImages.Get. +type VirtualMachineImagesGetResponse struct { + VirtualMachineImagesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineImagesGetResult contains the result from method VirtualMachineImages.Get. +type VirtualMachineImagesGetResult struct { + VirtualMachineImage +} + +// VirtualMachineImagesListOffersResponse contains the response from method VirtualMachineImages.ListOffers. +type VirtualMachineImagesListOffersResponse struct { + VirtualMachineImagesListOffersResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineImagesListOffersResult contains the result from method VirtualMachineImages.ListOffers. +type VirtualMachineImagesListOffersResult struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesListPublishersResponse contains the response from method VirtualMachineImages.ListPublishers. +type VirtualMachineImagesListPublishersResponse struct { + VirtualMachineImagesListPublishersResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineImagesListPublishersResult contains the result from method VirtualMachineImages.ListPublishers. +type VirtualMachineImagesListPublishersResult struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesListResponse contains the response from method VirtualMachineImages.List. +type VirtualMachineImagesListResponse struct { + VirtualMachineImagesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineImagesListResult contains the result from method VirtualMachineImages.List. +type VirtualMachineImagesListResult struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineImagesListSKUsResponse contains the response from method VirtualMachineImages.ListSKUs. +type VirtualMachineImagesListSKUsResponse struct { + VirtualMachineImagesListSKUsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineImagesListSKUsResult contains the result from method VirtualMachineImages.ListSKUs. +type VirtualMachineImagesListSKUsResult struct { + // Array of VirtualMachineImageResource + VirtualMachineImageResourceArray []*VirtualMachineImageResource +} + +// VirtualMachineRunCommandsCreateOrUpdatePollerResponse contains the response from method VirtualMachineRunCommands.CreateOrUpdate. +type VirtualMachineRunCommandsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineRunCommandsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineRunCommandsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineRunCommandsCreateOrUpdateResponse, error) { + respType := VirtualMachineRunCommandsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineRunCommand) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineRunCommandsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineRunCommandsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineRunCommandsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineRunCommandsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineRunCommandsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineRunCommandsCreateOrUpdateResponse contains the response from method VirtualMachineRunCommands.CreateOrUpdate. +type VirtualMachineRunCommandsCreateOrUpdateResponse struct { + VirtualMachineRunCommandsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineRunCommandsCreateOrUpdateResult contains the result from method VirtualMachineRunCommands.CreateOrUpdate. +type VirtualMachineRunCommandsCreateOrUpdateResult struct { + VirtualMachineRunCommand +} + +// VirtualMachineRunCommandsDeletePollerResponse contains the response from method VirtualMachineRunCommands.Delete. +type VirtualMachineRunCommandsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineRunCommandsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineRunCommandsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineRunCommandsDeleteResponse, error) { + respType := VirtualMachineRunCommandsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineRunCommandsDeletePollerResponse from the provided client and resume token. +func (l *VirtualMachineRunCommandsDeletePollerResponse) Resume(ctx context.Context, client *VirtualMachineRunCommandsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineRunCommandsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VirtualMachineRunCommandsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineRunCommandsDeleteResponse contains the response from method VirtualMachineRunCommands.Delete. +type VirtualMachineRunCommandsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineRunCommandsGetByVirtualMachineResponse contains the response from method VirtualMachineRunCommands.GetByVirtualMachine. +type VirtualMachineRunCommandsGetByVirtualMachineResponse struct { + VirtualMachineRunCommandsGetByVirtualMachineResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineRunCommandsGetByVirtualMachineResult contains the result from method VirtualMachineRunCommands.GetByVirtualMachine. +type VirtualMachineRunCommandsGetByVirtualMachineResult struct { + VirtualMachineRunCommand +} + +// VirtualMachineRunCommandsGetResponse contains the response from method VirtualMachineRunCommands.Get. +type VirtualMachineRunCommandsGetResponse struct { + VirtualMachineRunCommandsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineRunCommandsGetResult contains the result from method VirtualMachineRunCommands.Get. +type VirtualMachineRunCommandsGetResult struct { + RunCommandDocument +} + +// VirtualMachineRunCommandsListByVirtualMachineResponse contains the response from method VirtualMachineRunCommands.ListByVirtualMachine. +type VirtualMachineRunCommandsListByVirtualMachineResponse struct { + VirtualMachineRunCommandsListByVirtualMachineResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineRunCommandsListByVirtualMachineResult contains the result from method VirtualMachineRunCommands.ListByVirtualMachine. +type VirtualMachineRunCommandsListByVirtualMachineResult struct { + VirtualMachineRunCommandsListResult +} + +// VirtualMachineRunCommandsListResponse contains the response from method VirtualMachineRunCommands.List. +type VirtualMachineRunCommandsListResponse struct { + VirtualMachineRunCommandsListResultEnvelope + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineRunCommandsListResultEnvelope contains the result from method VirtualMachineRunCommands.List. +type VirtualMachineRunCommandsListResultEnvelope struct { + RunCommandListResult +} + +// VirtualMachineRunCommandsUpdatePollerResponse contains the response from method VirtualMachineRunCommands.Update. +type VirtualMachineRunCommandsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineRunCommandsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineRunCommandsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineRunCommandsUpdateResponse, error) { + respType := VirtualMachineRunCommandsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineRunCommand) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineRunCommandsUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineRunCommandsUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineRunCommandsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineRunCommandsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineRunCommandsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineRunCommandsUpdateResponse contains the response from method VirtualMachineRunCommands.Update. +type VirtualMachineRunCommandsUpdateResponse struct { + VirtualMachineRunCommandsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineRunCommandsUpdateResult contains the result from method VirtualMachineRunCommands.Update. +type VirtualMachineRunCommandsUpdateResult struct { + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse contains the response from method VirtualMachineScaleSetExtensions.CreateOrUpdate. +type VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetExtensionsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetExtensionsCreateOrUpdateResponse, error) { + respType := VirtualMachineScaleSetExtensionsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSetExtension) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetExtensionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetExtensionsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetExtensionsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetExtensionsCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetExtensions.CreateOrUpdate. +type VirtualMachineScaleSetExtensionsCreateOrUpdateResponse struct { + VirtualMachineScaleSetExtensionsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetExtensionsCreateOrUpdateResult contains the result from method VirtualMachineScaleSetExtensions.CreateOrUpdate. +type VirtualMachineScaleSetExtensionsCreateOrUpdateResult struct { + VirtualMachineScaleSetExtension +} + +// VirtualMachineScaleSetExtensionsDeletePollerResponse contains the response from method VirtualMachineScaleSetExtensions.Delete. +type VirtualMachineScaleSetExtensionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetExtensionsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetExtensionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetExtensionsDeleteResponse, error) { + respType := VirtualMachineScaleSetExtensionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetExtensionsDeletePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetExtensionsDeletePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetExtensionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetExtensionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetExtensionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetExtensionsDeleteResponse contains the response from method VirtualMachineScaleSetExtensions.Delete. +type VirtualMachineScaleSetExtensionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetExtensionsGetResponse contains the response from method VirtualMachineScaleSetExtensions.Get. +type VirtualMachineScaleSetExtensionsGetResponse struct { + VirtualMachineScaleSetExtensionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetExtensionsGetResult contains the result from method VirtualMachineScaleSetExtensions.Get. +type VirtualMachineScaleSetExtensionsGetResult struct { + VirtualMachineScaleSetExtension +} + +// VirtualMachineScaleSetExtensionsListResponse contains the response from method VirtualMachineScaleSetExtensions.List. +type VirtualMachineScaleSetExtensionsListResponse struct { + VirtualMachineScaleSetExtensionsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetExtensionsListResult contains the result from method VirtualMachineScaleSetExtensions.List. +type VirtualMachineScaleSetExtensionsListResult struct { + VirtualMachineScaleSetExtensionListResult +} + +// VirtualMachineScaleSetExtensionsUpdatePollerResponse contains the response from method VirtualMachineScaleSetExtensions.Update. +type VirtualMachineScaleSetExtensionsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetExtensionsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetExtensionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetExtensionsUpdateResponse, error) { + respType := VirtualMachineScaleSetExtensionsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSetExtension) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetExtensionsUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetExtensionsUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetExtensionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetExtensionsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetExtensionsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetExtensionsUpdateResponse contains the response from method VirtualMachineScaleSetExtensions.Update. +type VirtualMachineScaleSetExtensionsUpdateResponse struct { + VirtualMachineScaleSetExtensionsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetExtensionsUpdateResult contains the result from method VirtualMachineScaleSetExtensions.Update. +type VirtualMachineScaleSetExtensionsUpdateResult struct { + VirtualMachineScaleSetExtension +} + +// VirtualMachineScaleSetRollingUpgradesCancelPollerResponse contains the response from method VirtualMachineScaleSetRollingUpgrades.Cancel. +type VirtualMachineScaleSetRollingUpgradesCancelPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetRollingUpgradesCancelPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetRollingUpgradesCancelPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetRollingUpgradesCancelResponse, error) { + respType := VirtualMachineScaleSetRollingUpgradesCancelResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetRollingUpgradesCancelPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetRollingUpgradesCancelPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetRollingUpgradesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetRollingUpgradesClient.Cancel", token, client.pl, client.cancelHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetRollingUpgradesCancelPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetRollingUpgradesCancelResponse contains the response from method VirtualMachineScaleSetRollingUpgrades.Cancel. +type VirtualMachineScaleSetRollingUpgradesCancelResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetRollingUpgradesGetLatestResponse contains the response from method VirtualMachineScaleSetRollingUpgrades.GetLatest. +type VirtualMachineScaleSetRollingUpgradesGetLatestResponse struct { + VirtualMachineScaleSetRollingUpgradesGetLatestResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetRollingUpgradesGetLatestResult contains the result from method VirtualMachineScaleSetRollingUpgrades.GetLatest. +type VirtualMachineScaleSetRollingUpgradesGetLatestResult struct { + RollingUpgradeStatusInfo +} + +// VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse contains the response from method VirtualMachineScaleSetRollingUpgrades.StartExtensionUpgrade. +type VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeResponse, error) { + respType := VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetRollingUpgradesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgrade", token, client.pl, client.startExtensionUpgradeHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeResponse contains the response from method VirtualMachineScaleSetRollingUpgrades.StartExtensionUpgrade. +type VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse contains the response from method VirtualMachineScaleSetRollingUpgrades.StartOSUpgrade. +type VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetRollingUpgradesStartOSUpgradePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetRollingUpgradesStartOSUpgradeResponse, error) { + respType := VirtualMachineScaleSetRollingUpgradesStartOSUpgradeResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetRollingUpgradesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade", token, client.pl, client.startOSUpgradeHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetRollingUpgradesStartOSUpgradePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetRollingUpgradesStartOSUpgradeResponse contains the response from method VirtualMachineScaleSetRollingUpgrades.StartOSUpgrade. +type VirtualMachineScaleSetRollingUpgradesStartOSUpgradeResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse contains the response from method VirtualMachineScaleSetVMExtensions.CreateOrUpdate. +type VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMExtensionsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMExtensionsCreateOrUpdateResponse, error) { + respType := VirtualMachineScaleSetVMExtensionsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSetVMExtension) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMExtensionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMExtensionsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMExtensionsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMExtensionsCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetVMExtensions.CreateOrUpdate. +type VirtualMachineScaleSetVMExtensionsCreateOrUpdateResponse struct { + VirtualMachineScaleSetVMExtensionsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMExtensionsCreateOrUpdateResult contains the result from method VirtualMachineScaleSetVMExtensions.CreateOrUpdate. +type VirtualMachineScaleSetVMExtensionsCreateOrUpdateResult struct { + VirtualMachineScaleSetVMExtension +} + +// VirtualMachineScaleSetVMExtensionsDeletePollerResponse contains the response from method VirtualMachineScaleSetVMExtensions.Delete. +type VirtualMachineScaleSetVMExtensionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMExtensionsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMExtensionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMExtensionsDeleteResponse, error) { + respType := VirtualMachineScaleSetVMExtensionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMExtensionsDeletePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMExtensionsDeletePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMExtensionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMExtensionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMExtensionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMExtensionsDeleteResponse contains the response from method VirtualMachineScaleSetVMExtensions.Delete. +type VirtualMachineScaleSetVMExtensionsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMExtensionsGetResponse contains the response from method VirtualMachineScaleSetVMExtensions.Get. +type VirtualMachineScaleSetVMExtensionsGetResponse struct { + VirtualMachineScaleSetVMExtensionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMExtensionsGetResult contains the result from method VirtualMachineScaleSetVMExtensions.Get. +type VirtualMachineScaleSetVMExtensionsGetResult struct { + VirtualMachineScaleSetVMExtension +} + +// VirtualMachineScaleSetVMExtensionsListResponse contains the response from method VirtualMachineScaleSetVMExtensions.List. +type VirtualMachineScaleSetVMExtensionsListResponse struct { + VirtualMachineScaleSetVMExtensionsListResultEnvelope + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMExtensionsListResultEnvelope contains the result from method VirtualMachineScaleSetVMExtensions.List. +type VirtualMachineScaleSetVMExtensionsListResultEnvelope struct { + VirtualMachineScaleSetVMExtensionsListResult +} + +// VirtualMachineScaleSetVMExtensionsUpdatePollerResponse contains the response from method VirtualMachineScaleSetVMExtensions.Update. +type VirtualMachineScaleSetVMExtensionsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMExtensionsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMExtensionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMExtensionsUpdateResponse, error) { + respType := VirtualMachineScaleSetVMExtensionsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSetVMExtension) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMExtensionsUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMExtensionsUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMExtensionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMExtensionsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMExtensionsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMExtensionsUpdateResponse contains the response from method VirtualMachineScaleSetVMExtensions.Update. +type VirtualMachineScaleSetVMExtensionsUpdateResponse struct { + VirtualMachineScaleSetVMExtensionsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMExtensionsUpdateResult contains the result from method VirtualMachineScaleSetVMExtensions.Update. +type VirtualMachineScaleSetVMExtensionsUpdateResult struct { + VirtualMachineScaleSetVMExtension +} + +// VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse contains the response from method VirtualMachineScaleSetVMRunCommands.CreateOrUpdate. +type VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResponse, error) { + respType := VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineRunCommand) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMRunCommandsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMRunCommandsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResponse contains the response from method VirtualMachineScaleSetVMRunCommands.CreateOrUpdate. +type VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResponse struct { + VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResult contains the result from method VirtualMachineScaleSetVMRunCommands.CreateOrUpdate. +type VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResult struct { + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetVMRunCommandsDeletePollerResponse contains the response from method VirtualMachineScaleSetVMRunCommands.Delete. +type VirtualMachineScaleSetVMRunCommandsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMRunCommandsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMRunCommandsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMRunCommandsDeleteResponse, error) { + respType := VirtualMachineScaleSetVMRunCommandsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMRunCommandsDeletePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMRunCommandsDeletePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMRunCommandsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMRunCommandsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMRunCommandsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMRunCommandsDeleteResponse contains the response from method VirtualMachineScaleSetVMRunCommands.Delete. +type VirtualMachineScaleSetVMRunCommandsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMRunCommandsGetResponse contains the response from method VirtualMachineScaleSetVMRunCommands.Get. +type VirtualMachineScaleSetVMRunCommandsGetResponse struct { + VirtualMachineScaleSetVMRunCommandsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMRunCommandsGetResult contains the result from method VirtualMachineScaleSetVMRunCommands.Get. +type VirtualMachineScaleSetVMRunCommandsGetResult struct { + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetVMRunCommandsListResponse contains the response from method VirtualMachineScaleSetVMRunCommands.List. +type VirtualMachineScaleSetVMRunCommandsListResponse struct { + VirtualMachineScaleSetVMRunCommandsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMRunCommandsListResult contains the result from method VirtualMachineScaleSetVMRunCommands.List. +type VirtualMachineScaleSetVMRunCommandsListResult struct { + VirtualMachineRunCommandsListResult +} + +// VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse contains the response from method VirtualMachineScaleSetVMRunCommands.Update. +type VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMRunCommandsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMRunCommandsUpdateResponse, error) { + respType := VirtualMachineScaleSetVMRunCommandsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineRunCommand) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMRunCommandsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMRunCommandsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMRunCommandsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMRunCommandsUpdateResponse contains the response from method VirtualMachineScaleSetVMRunCommands.Update. +type VirtualMachineScaleSetVMRunCommandsUpdateResponse struct { + VirtualMachineScaleSetVMRunCommandsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMRunCommandsUpdateResult contains the result from method VirtualMachineScaleSetVMRunCommands.Update. +type VirtualMachineScaleSetVMRunCommandsUpdateResult struct { + VirtualMachineRunCommand +} + +// VirtualMachineScaleSetVMsDeallocatePollerResponse contains the response from method VirtualMachineScaleSetVMs.Deallocate. +type VirtualMachineScaleSetVMsDeallocatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsDeallocatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsDeallocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsDeallocateResponse, error) { + respType := VirtualMachineScaleSetVMsDeallocateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsDeallocatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsDeallocatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Deallocate", token, client.pl, client.deallocateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsDeallocatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsDeallocateResponse contains the response from method VirtualMachineScaleSetVMs.Deallocate. +type VirtualMachineScaleSetVMsDeallocateResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsDeletePollerResponse contains the response from method VirtualMachineScaleSetVMs.Delete. +type VirtualMachineScaleSetVMsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsDeleteResponse, error) { + respType := VirtualMachineScaleSetVMsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsDeletePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsDeletePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsDeleteResponse contains the response from method VirtualMachineScaleSetVMs.Delete. +type VirtualMachineScaleSetVMsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsGetInstanceViewResponse contains the response from method VirtualMachineScaleSetVMs.GetInstanceView. +type VirtualMachineScaleSetVMsGetInstanceViewResponse struct { + VirtualMachineScaleSetVMsGetInstanceViewResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsGetInstanceViewResult contains the result from method VirtualMachineScaleSetVMs.GetInstanceView. +type VirtualMachineScaleSetVMsGetInstanceViewResult struct { + VirtualMachineScaleSetVMInstanceView +} + +// VirtualMachineScaleSetVMsGetResponse contains the response from method VirtualMachineScaleSetVMs.Get. +type VirtualMachineScaleSetVMsGetResponse struct { + VirtualMachineScaleSetVMsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsGetResult contains the result from method VirtualMachineScaleSetVMs.Get. +type VirtualMachineScaleSetVMsGetResult struct { + VirtualMachineScaleSetVM +} + +// VirtualMachineScaleSetVMsListResponse contains the response from method VirtualMachineScaleSetVMs.List. +type VirtualMachineScaleSetVMsListResponse struct { + VirtualMachineScaleSetVMsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsListResult contains the result from method VirtualMachineScaleSetVMs.List. +type VirtualMachineScaleSetVMsListResult struct { + VirtualMachineScaleSetVMListResult +} + +// VirtualMachineScaleSetVMsPerformMaintenancePollerResponse contains the response from method VirtualMachineScaleSetVMs.PerformMaintenance. +type VirtualMachineScaleSetVMsPerformMaintenancePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsPerformMaintenancePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsPerformMaintenancePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsPerformMaintenanceResponse, error) { + respType := VirtualMachineScaleSetVMsPerformMaintenanceResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsPerformMaintenancePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsPerformMaintenancePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.PerformMaintenance", token, client.pl, client.performMaintenanceHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsPerformMaintenancePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsPerformMaintenanceResponse contains the response from method VirtualMachineScaleSetVMs.PerformMaintenance. +type VirtualMachineScaleSetVMsPerformMaintenanceResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsPowerOffPollerResponse contains the response from method VirtualMachineScaleSetVMs.PowerOff. +type VirtualMachineScaleSetVMsPowerOffPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsPowerOffPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsPowerOffPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsPowerOffResponse, error) { + respType := VirtualMachineScaleSetVMsPowerOffResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsPowerOffPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsPowerOffPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.PowerOff", token, client.pl, client.powerOffHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsPowerOffPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsPowerOffResponse contains the response from method VirtualMachineScaleSetVMs.PowerOff. +type VirtualMachineScaleSetVMsPowerOffResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsRedeployPollerResponse contains the response from method VirtualMachineScaleSetVMs.Redeploy. +type VirtualMachineScaleSetVMsRedeployPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsRedeployPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsRedeployPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsRedeployResponse, error) { + respType := VirtualMachineScaleSetVMsRedeployResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsRedeployPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsRedeployPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Redeploy", token, client.pl, client.redeployHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsRedeployPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsRedeployResponse contains the response from method VirtualMachineScaleSetVMs.Redeploy. +type VirtualMachineScaleSetVMsRedeployResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsReimageAllPollerResponse contains the response from method VirtualMachineScaleSetVMs.ReimageAll. +type VirtualMachineScaleSetVMsReimageAllPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsReimageAllPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsReimageAllPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsReimageAllResponse, error) { + respType := VirtualMachineScaleSetVMsReimageAllResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsReimageAllPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsReimageAllPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.ReimageAll", token, client.pl, client.reimageAllHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsReimageAllPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsReimageAllResponse contains the response from method VirtualMachineScaleSetVMs.ReimageAll. +type VirtualMachineScaleSetVMsReimageAllResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsReimagePollerResponse contains the response from method VirtualMachineScaleSetVMs.Reimage. +type VirtualMachineScaleSetVMsReimagePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsReimagePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsReimageResponse, error) { + respType := VirtualMachineScaleSetVMsReimageResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsReimagePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsReimagePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Reimage", token, client.pl, client.reimageHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsReimagePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsReimageResponse contains the response from method VirtualMachineScaleSetVMs.Reimage. +type VirtualMachineScaleSetVMsReimageResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsRestartPollerResponse contains the response from method VirtualMachineScaleSetVMs.Restart. +type VirtualMachineScaleSetVMsRestartPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsRestartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsRestartResponse, error) { + respType := VirtualMachineScaleSetVMsRestartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsRestartPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsRestartPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Restart", token, client.pl, client.restartHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsRestartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsRestartResponse contains the response from method VirtualMachineScaleSetVMs.Restart. +type VirtualMachineScaleSetVMsRestartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse contains the response from method VirtualMachineScaleSetVMs.RetrieveBootDiagnosticsData. +type VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse struct { + VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResult contains the result from method VirtualMachineScaleSetVMs.RetrieveBootDiagnosticsData. +type VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResult struct { + RetrieveBootDiagnosticsDataResult +} + +// VirtualMachineScaleSetVMsRunCommandPollerResponse contains the response from method VirtualMachineScaleSetVMs.RunCommand. +type VirtualMachineScaleSetVMsRunCommandPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsRunCommandPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsRunCommandPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsRunCommandResponse, error) { + respType := VirtualMachineScaleSetVMsRunCommandResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RunCommandResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsRunCommandPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsRunCommandPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.RunCommand", token, client.pl, client.runCommandHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsRunCommandPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsRunCommandResponse contains the response from method VirtualMachineScaleSetVMs.RunCommand. +type VirtualMachineScaleSetVMsRunCommandResponse struct { + VirtualMachineScaleSetVMsRunCommandResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsRunCommandResult contains the result from method VirtualMachineScaleSetVMs.RunCommand. +type VirtualMachineScaleSetVMsRunCommandResult struct { + RunCommandResult +} + +// VirtualMachineScaleSetVMsSimulateEvictionResponse contains the response from method VirtualMachineScaleSetVMs.SimulateEviction. +type VirtualMachineScaleSetVMsSimulateEvictionResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsStartPollerResponse contains the response from method VirtualMachineScaleSetVMs.Start. +type VirtualMachineScaleSetVMsStartPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsStartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsStartResponse, error) { + respType := VirtualMachineScaleSetVMsStartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsStartPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsStartPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Start", token, client.pl, client.startHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsStartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsStartResponse contains the response from method VirtualMachineScaleSetVMs.Start. +type VirtualMachineScaleSetVMsStartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsUpdatePollerResponse contains the response from method VirtualMachineScaleSetVMs.Update. +type VirtualMachineScaleSetVMsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetVMsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetVMsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsUpdateResponse, error) { + respType := VirtualMachineScaleSetVMsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSetVM) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetVMsUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetVMsUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetVMsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetVMsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetVMsUpdateResponse contains the response from method VirtualMachineScaleSetVMs.Update. +type VirtualMachineScaleSetVMsUpdateResponse struct { + VirtualMachineScaleSetVMsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetVMsUpdateResult contains the result from method VirtualMachineScaleSetVMs.Update. +type VirtualMachineScaleSetVMsUpdateResult struct { + VirtualMachineScaleSetVM +} + +// VirtualMachineScaleSetsConvertToSinglePlacementGroupResponse contains the response from method VirtualMachineScaleSets.ConvertToSinglePlacementGroup. +type VirtualMachineScaleSetsConvertToSinglePlacementGroupResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsCreateOrUpdatePollerResponse contains the response from method VirtualMachineScaleSets.CreateOrUpdate. +type VirtualMachineScaleSetsCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsCreateOrUpdateResponse, error) { + respType := VirtualMachineScaleSetsCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSet) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsCreateOrUpdateResponse contains the response from method VirtualMachineScaleSets.CreateOrUpdate. +type VirtualMachineScaleSetsCreateOrUpdateResponse struct { + VirtualMachineScaleSetsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsCreateOrUpdateResult contains the result from method VirtualMachineScaleSets.CreateOrUpdate. +type VirtualMachineScaleSetsCreateOrUpdateResult struct { + VirtualMachineScaleSet +} + +// VirtualMachineScaleSetsDeallocatePollerResponse contains the response from method VirtualMachineScaleSets.Deallocate. +type VirtualMachineScaleSetsDeallocatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsDeallocatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsDeallocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsDeallocateResponse, error) { + respType := VirtualMachineScaleSetsDeallocateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsDeallocatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsDeallocatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.Deallocate", token, client.pl, client.deallocateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsDeallocatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsDeallocateResponse contains the response from method VirtualMachineScaleSets.Deallocate. +type VirtualMachineScaleSetsDeallocateResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsDeleteInstancesPollerResponse contains the response from method VirtualMachineScaleSets.DeleteInstances. +type VirtualMachineScaleSetsDeleteInstancesPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsDeleteInstancesPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsDeleteInstancesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsDeleteInstancesResponse, error) { + respType := VirtualMachineScaleSetsDeleteInstancesResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsDeleteInstancesPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsDeleteInstancesPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.DeleteInstances", token, client.pl, client.deleteInstancesHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsDeleteInstancesPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsDeleteInstancesResponse contains the response from method VirtualMachineScaleSets.DeleteInstances. +type VirtualMachineScaleSetsDeleteInstancesResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsDeletePollerResponse contains the response from method VirtualMachineScaleSets.Delete. +type VirtualMachineScaleSetsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsDeleteResponse, error) { + respType := VirtualMachineScaleSetsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsDeletePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsDeletePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsDeleteResponse contains the response from method VirtualMachineScaleSets.Delete. +type VirtualMachineScaleSetsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse contains the response from method VirtualMachineScaleSets.ForceRecoveryServiceFabricPlatformUpdateDomainWalk. +type VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse struct { + VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResult contains the result from method VirtualMachineScaleSets.ForceRecoveryServiceFabricPlatformUpdateDomainWalk. +type VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResult struct { + RecoveryWalkResponse +} + +// VirtualMachineScaleSetsGetInstanceViewResponse contains the response from method VirtualMachineScaleSets.GetInstanceView. +type VirtualMachineScaleSetsGetInstanceViewResponse struct { + VirtualMachineScaleSetsGetInstanceViewResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsGetInstanceViewResult contains the result from method VirtualMachineScaleSets.GetInstanceView. +type VirtualMachineScaleSetsGetInstanceViewResult struct { + VirtualMachineScaleSetInstanceView +} + +// VirtualMachineScaleSetsGetOSUpgradeHistoryResponse contains the response from method VirtualMachineScaleSets.GetOSUpgradeHistory. +type VirtualMachineScaleSetsGetOSUpgradeHistoryResponse struct { + VirtualMachineScaleSetsGetOSUpgradeHistoryResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsGetOSUpgradeHistoryResult contains the result from method VirtualMachineScaleSets.GetOSUpgradeHistory. +type VirtualMachineScaleSetsGetOSUpgradeHistoryResult struct { + VirtualMachineScaleSetListOSUpgradeHistory +} + +// VirtualMachineScaleSetsGetResponse contains the response from method VirtualMachineScaleSets.Get. +type VirtualMachineScaleSetsGetResponse struct { + VirtualMachineScaleSetsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsGetResult contains the result from method VirtualMachineScaleSets.Get. +type VirtualMachineScaleSetsGetResult struct { + VirtualMachineScaleSet +} + +// VirtualMachineScaleSetsListAllResponse contains the response from method VirtualMachineScaleSets.ListAll. +type VirtualMachineScaleSetsListAllResponse struct { + VirtualMachineScaleSetsListAllResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsListAllResult contains the result from method VirtualMachineScaleSets.ListAll. +type VirtualMachineScaleSetsListAllResult struct { + VirtualMachineScaleSetListWithLinkResult +} + +// VirtualMachineScaleSetsListByLocationResponse contains the response from method VirtualMachineScaleSets.ListByLocation. +type VirtualMachineScaleSetsListByLocationResponse struct { + VirtualMachineScaleSetsListByLocationResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsListByLocationResult contains the result from method VirtualMachineScaleSets.ListByLocation. +type VirtualMachineScaleSetsListByLocationResult struct { + VirtualMachineScaleSetListResult +} + +// VirtualMachineScaleSetsListResponse contains the response from method VirtualMachineScaleSets.List. +type VirtualMachineScaleSetsListResponse struct { + VirtualMachineScaleSetsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsListResult contains the result from method VirtualMachineScaleSets.List. +type VirtualMachineScaleSetsListResult struct { + VirtualMachineScaleSetListResult +} + +// VirtualMachineScaleSetsListSKUsResponse contains the response from method VirtualMachineScaleSets.ListSKUs. +type VirtualMachineScaleSetsListSKUsResponse struct { + VirtualMachineScaleSetsListSKUsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsListSKUsResult contains the result from method VirtualMachineScaleSets.ListSKUs. +type VirtualMachineScaleSetsListSKUsResult struct { + VirtualMachineScaleSetListSKUsResult +} + +// VirtualMachineScaleSetsPerformMaintenancePollerResponse contains the response from method VirtualMachineScaleSets.PerformMaintenance. +type VirtualMachineScaleSetsPerformMaintenancePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsPerformMaintenancePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsPerformMaintenancePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsPerformMaintenanceResponse, error) { + respType := VirtualMachineScaleSetsPerformMaintenanceResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsPerformMaintenancePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsPerformMaintenancePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.PerformMaintenance", token, client.pl, client.performMaintenanceHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsPerformMaintenancePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsPerformMaintenanceResponse contains the response from method VirtualMachineScaleSets.PerformMaintenance. +type VirtualMachineScaleSetsPerformMaintenanceResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsPowerOffPollerResponse contains the response from method VirtualMachineScaleSets.PowerOff. +type VirtualMachineScaleSetsPowerOffPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsPowerOffPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsPowerOffPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsPowerOffResponse, error) { + respType := VirtualMachineScaleSetsPowerOffResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsPowerOffPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsPowerOffPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.PowerOff", token, client.pl, client.powerOffHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsPowerOffPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsPowerOffResponse contains the response from method VirtualMachineScaleSets.PowerOff. +type VirtualMachineScaleSetsPowerOffResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsRedeployPollerResponse contains the response from method VirtualMachineScaleSets.Redeploy. +type VirtualMachineScaleSetsRedeployPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsRedeployPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsRedeployPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsRedeployResponse, error) { + respType := VirtualMachineScaleSetsRedeployResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsRedeployPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsRedeployPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.Redeploy", token, client.pl, client.redeployHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsRedeployPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsRedeployResponse contains the response from method VirtualMachineScaleSets.Redeploy. +type VirtualMachineScaleSetsRedeployResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsReimageAllPollerResponse contains the response from method VirtualMachineScaleSets.ReimageAll. +type VirtualMachineScaleSetsReimageAllPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsReimageAllPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsReimageAllPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsReimageAllResponse, error) { + respType := VirtualMachineScaleSetsReimageAllResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsReimageAllPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsReimageAllPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.ReimageAll", token, client.pl, client.reimageAllHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsReimageAllPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsReimageAllResponse contains the response from method VirtualMachineScaleSets.ReimageAll. +type VirtualMachineScaleSetsReimageAllResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsReimagePollerResponse contains the response from method VirtualMachineScaleSets.Reimage. +type VirtualMachineScaleSetsReimagePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsReimagePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsReimageResponse, error) { + respType := VirtualMachineScaleSetsReimageResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsReimagePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsReimagePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.Reimage", token, client.pl, client.reimageHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsReimagePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsReimageResponse contains the response from method VirtualMachineScaleSets.Reimage. +type VirtualMachineScaleSetsReimageResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsRestartPollerResponse contains the response from method VirtualMachineScaleSets.Restart. +type VirtualMachineScaleSetsRestartPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsRestartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsRestartResponse, error) { + respType := VirtualMachineScaleSetsRestartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsRestartPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsRestartPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.Restart", token, client.pl, client.restartHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsRestartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsRestartResponse contains the response from method VirtualMachineScaleSets.Restart. +type VirtualMachineScaleSetsRestartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse contains the response from method VirtualMachineScaleSets.SetOrchestrationServiceState. +type VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsSetOrchestrationServiceStatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsSetOrchestrationServiceStateResponse, error) { + respType := VirtualMachineScaleSetsSetOrchestrationServiceStateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.SetOrchestrationServiceState", token, client.pl, client.setOrchestrationServiceStateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsSetOrchestrationServiceStatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsSetOrchestrationServiceStateResponse contains the response from method VirtualMachineScaleSets.SetOrchestrationServiceState. +type VirtualMachineScaleSetsSetOrchestrationServiceStateResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsStartPollerResponse contains the response from method VirtualMachineScaleSets.Start. +type VirtualMachineScaleSetsStartPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsStartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsStartResponse, error) { + respType := VirtualMachineScaleSetsStartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsStartPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsStartPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.Start", token, client.pl, client.startHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsStartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsStartResponse contains the response from method VirtualMachineScaleSets.Start. +type VirtualMachineScaleSetsStartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsUpdateInstancesPollerResponse contains the response from method VirtualMachineScaleSets.UpdateInstances. +type VirtualMachineScaleSetsUpdateInstancesPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsUpdateInstancesPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsUpdateInstancesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsUpdateInstancesResponse, error) { + respType := VirtualMachineScaleSetsUpdateInstancesResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsUpdateInstancesPollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsUpdateInstancesPollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.UpdateInstances", token, client.pl, client.updateInstancesHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsUpdateInstancesPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsUpdateInstancesResponse contains the response from method VirtualMachineScaleSets.UpdateInstances. +type VirtualMachineScaleSetsUpdateInstancesResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsUpdatePollerResponse contains the response from method VirtualMachineScaleSets.Update. +type VirtualMachineScaleSetsUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachineScaleSetsUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachineScaleSetsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsUpdateResponse, error) { + respType := VirtualMachineScaleSetsUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSet) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachineScaleSetsUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachineScaleSetsUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachineScaleSetsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachineScaleSetsClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &VirtualMachineScaleSetsUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachineScaleSetsUpdateResponse contains the response from method VirtualMachineScaleSets.Update. +type VirtualMachineScaleSetsUpdateResponse struct { + VirtualMachineScaleSetsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineScaleSetsUpdateResult contains the result from method VirtualMachineScaleSets.Update. +type VirtualMachineScaleSetsUpdateResult struct { + VirtualMachineScaleSet +} + +// VirtualMachineSizesListResponse contains the response from method VirtualMachineSizes.List. +type VirtualMachineSizesListResponse struct { + VirtualMachineSizesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachineSizesListResult contains the result from method VirtualMachineSizes.List. +type VirtualMachineSizesListResult struct { + VirtualMachineSizeListResult +} + +// VirtualMachinesAssessPatchesPollerResponse contains the response from method VirtualMachines.AssessPatches. +type VirtualMachinesAssessPatchesPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesAssessPatchesPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesAssessPatchesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesAssessPatchesResponse, error) { + respType := VirtualMachinesAssessPatchesResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineAssessPatchesResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesAssessPatchesPollerResponse from the provided client and resume token. +func (l *VirtualMachinesAssessPatchesPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.AssessPatches", token, client.pl, client.assessPatchesHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesAssessPatchesPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesAssessPatchesResponse contains the response from method VirtualMachines.AssessPatches. +type VirtualMachinesAssessPatchesResponse struct { + VirtualMachinesAssessPatchesResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesAssessPatchesResult contains the result from method VirtualMachines.AssessPatches. +type VirtualMachinesAssessPatchesResult struct { + VirtualMachineAssessPatchesResult +} + +// VirtualMachinesCapturePollerResponse contains the response from method VirtualMachines.Capture. +type VirtualMachinesCapturePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesCapturePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesCapturePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesCaptureResponse, error) { + respType := VirtualMachinesCaptureResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineCaptureResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesCapturePollerResponse from the provided client and resume token. +func (l *VirtualMachinesCapturePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Capture", token, client.pl, client.captureHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesCapturePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesCaptureResponse contains the response from method VirtualMachines.Capture. +type VirtualMachinesCaptureResponse struct { + VirtualMachinesCaptureResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesCaptureResult contains the result from method VirtualMachines.Capture. +type VirtualMachinesCaptureResult struct { + VirtualMachineCaptureResult +} + +// VirtualMachinesConvertToManagedDisksPollerResponse contains the response from method VirtualMachines.ConvertToManagedDisks. +type VirtualMachinesConvertToManagedDisksPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesConvertToManagedDisksPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesConvertToManagedDisksPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesConvertToManagedDisksResponse, error) { + respType := VirtualMachinesConvertToManagedDisksResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesConvertToManagedDisksPollerResponse from the provided client and resume token. +func (l *VirtualMachinesConvertToManagedDisksPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.ConvertToManagedDisks", token, client.pl, client.convertToManagedDisksHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesConvertToManagedDisksPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesConvertToManagedDisksResponse contains the response from method VirtualMachines.ConvertToManagedDisks. +type VirtualMachinesConvertToManagedDisksResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesCreateOrUpdatePollerResponse contains the response from method VirtualMachines.CreateOrUpdate. +type VirtualMachinesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesCreateOrUpdateResponse, error) { + respType := VirtualMachinesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachine) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachinesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesCreateOrUpdateResponse contains the response from method VirtualMachines.CreateOrUpdate. +type VirtualMachinesCreateOrUpdateResponse struct { + VirtualMachinesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesCreateOrUpdateResult contains the result from method VirtualMachines.CreateOrUpdate. +type VirtualMachinesCreateOrUpdateResult struct { + VirtualMachine +} + +// VirtualMachinesDeallocatePollerResponse contains the response from method VirtualMachines.Deallocate. +type VirtualMachinesDeallocatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesDeallocatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesDeallocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesDeallocateResponse, error) { + respType := VirtualMachinesDeallocateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesDeallocatePollerResponse from the provided client and resume token. +func (l *VirtualMachinesDeallocatePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Deallocate", token, client.pl, client.deallocateHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesDeallocatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesDeallocateResponse contains the response from method VirtualMachines.Deallocate. +type VirtualMachinesDeallocateResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesDeletePollerResponse contains the response from method VirtualMachines.Delete. +type VirtualMachinesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesDeleteResponse, error) { + respType := VirtualMachinesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesDeletePollerResponse from the provided client and resume token. +func (l *VirtualMachinesDeletePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesDeleteResponse contains the response from method VirtualMachines.Delete. +type VirtualMachinesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesGeneralizeResponse contains the response from method VirtualMachines.Generalize. +type VirtualMachinesGeneralizeResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesGetResponse contains the response from method VirtualMachines.Get. +type VirtualMachinesGetResponse struct { + VirtualMachinesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesGetResult contains the result from method VirtualMachines.Get. +type VirtualMachinesGetResult struct { + VirtualMachine +} + +// VirtualMachinesInstallPatchesPollerResponse contains the response from method VirtualMachines.InstallPatches. +type VirtualMachinesInstallPatchesPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesInstallPatchesPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesInstallPatchesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesInstallPatchesResponse, error) { + respType := VirtualMachinesInstallPatchesResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineInstallPatchesResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesInstallPatchesPollerResponse from the provided client and resume token. +func (l *VirtualMachinesInstallPatchesPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.InstallPatches", token, client.pl, client.installPatchesHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesInstallPatchesPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesInstallPatchesResponse contains the response from method VirtualMachines.InstallPatches. +type VirtualMachinesInstallPatchesResponse struct { + VirtualMachinesInstallPatchesResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesInstallPatchesResult contains the result from method VirtualMachines.InstallPatches. +type VirtualMachinesInstallPatchesResult struct { + VirtualMachineInstallPatchesResult +} + +// VirtualMachinesInstanceViewResponse contains the response from method VirtualMachines.InstanceView. +type VirtualMachinesInstanceViewResponse struct { + VirtualMachinesInstanceViewResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesInstanceViewResult contains the result from method VirtualMachines.InstanceView. +type VirtualMachinesInstanceViewResult struct { + VirtualMachineInstanceView +} + +// VirtualMachinesListAllResponse contains the response from method VirtualMachines.ListAll. +type VirtualMachinesListAllResponse struct { + VirtualMachinesListAllResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesListAllResult contains the result from method VirtualMachines.ListAll. +type VirtualMachinesListAllResult struct { + VirtualMachineListResult +} + +// VirtualMachinesListAvailableSizesResponse contains the response from method VirtualMachines.ListAvailableSizes. +type VirtualMachinesListAvailableSizesResponse struct { + VirtualMachinesListAvailableSizesResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesListAvailableSizesResult contains the result from method VirtualMachines.ListAvailableSizes. +type VirtualMachinesListAvailableSizesResult struct { + VirtualMachineSizeListResult +} + +// VirtualMachinesListByLocationResponse contains the response from method VirtualMachines.ListByLocation. +type VirtualMachinesListByLocationResponse struct { + VirtualMachinesListByLocationResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesListByLocationResult contains the result from method VirtualMachines.ListByLocation. +type VirtualMachinesListByLocationResult struct { + VirtualMachineListResult +} + +// VirtualMachinesListResponse contains the response from method VirtualMachines.List. +type VirtualMachinesListResponse struct { + VirtualMachinesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesListResult contains the result from method VirtualMachines.List. +type VirtualMachinesListResult struct { + VirtualMachineListResult +} + +// VirtualMachinesPerformMaintenancePollerResponse contains the response from method VirtualMachines.PerformMaintenance. +type VirtualMachinesPerformMaintenancePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesPerformMaintenancePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesPerformMaintenancePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesPerformMaintenanceResponse, error) { + respType := VirtualMachinesPerformMaintenanceResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesPerformMaintenancePollerResponse from the provided client and resume token. +func (l *VirtualMachinesPerformMaintenancePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.PerformMaintenance", token, client.pl, client.performMaintenanceHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesPerformMaintenancePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesPerformMaintenanceResponse contains the response from method VirtualMachines.PerformMaintenance. +type VirtualMachinesPerformMaintenanceResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesPowerOffPollerResponse contains the response from method VirtualMachines.PowerOff. +type VirtualMachinesPowerOffPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesPowerOffPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesPowerOffPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesPowerOffResponse, error) { + respType := VirtualMachinesPowerOffResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesPowerOffPollerResponse from the provided client and resume token. +func (l *VirtualMachinesPowerOffPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.PowerOff", token, client.pl, client.powerOffHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesPowerOffPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesPowerOffResponse contains the response from method VirtualMachines.PowerOff. +type VirtualMachinesPowerOffResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesReapplyPollerResponse contains the response from method VirtualMachines.Reapply. +type VirtualMachinesReapplyPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesReapplyPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesReapplyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesReapplyResponse, error) { + respType := VirtualMachinesReapplyResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesReapplyPollerResponse from the provided client and resume token. +func (l *VirtualMachinesReapplyPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Reapply", token, client.pl, client.reapplyHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesReapplyPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesReapplyResponse contains the response from method VirtualMachines.Reapply. +type VirtualMachinesReapplyResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesRedeployPollerResponse contains the response from method VirtualMachines.Redeploy. +type VirtualMachinesRedeployPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesRedeployPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesRedeployPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesRedeployResponse, error) { + respType := VirtualMachinesRedeployResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesRedeployPollerResponse from the provided client and resume token. +func (l *VirtualMachinesRedeployPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Redeploy", token, client.pl, client.redeployHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesRedeployPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesRedeployResponse contains the response from method VirtualMachines.Redeploy. +type VirtualMachinesRedeployResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesReimagePollerResponse contains the response from method VirtualMachines.Reimage. +type VirtualMachinesReimagePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesReimagePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesReimageResponse, error) { + respType := VirtualMachinesReimageResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesReimagePollerResponse from the provided client and resume token. +func (l *VirtualMachinesReimagePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Reimage", token, client.pl, client.reimageHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesReimagePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesReimageResponse contains the response from method VirtualMachines.Reimage. +type VirtualMachinesReimageResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesRestartPollerResponse contains the response from method VirtualMachines.Restart. +type VirtualMachinesRestartPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesRestartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesRestartResponse, error) { + respType := VirtualMachinesRestartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesRestartPollerResponse from the provided client and resume token. +func (l *VirtualMachinesRestartPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Restart", token, client.pl, client.restartHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesRestartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesRestartResponse contains the response from method VirtualMachines.Restart. +type VirtualMachinesRestartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesRetrieveBootDiagnosticsDataResponse contains the response from method VirtualMachines.RetrieveBootDiagnosticsData. +type VirtualMachinesRetrieveBootDiagnosticsDataResponse struct { + VirtualMachinesRetrieveBootDiagnosticsDataResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesRetrieveBootDiagnosticsDataResult contains the result from method VirtualMachines.RetrieveBootDiagnosticsData. +type VirtualMachinesRetrieveBootDiagnosticsDataResult struct { + RetrieveBootDiagnosticsDataResult +} + +// VirtualMachinesRunCommandPollerResponse contains the response from method VirtualMachines.RunCommand. +type VirtualMachinesRunCommandPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesRunCommandPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesRunCommandPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesRunCommandResponse, error) { + respType := VirtualMachinesRunCommandResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RunCommandResult) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesRunCommandPollerResponse from the provided client and resume token. +func (l *VirtualMachinesRunCommandPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.RunCommand", token, client.pl, client.runCommandHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesRunCommandPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesRunCommandResponse contains the response from method VirtualMachines.RunCommand. +type VirtualMachinesRunCommandResponse struct { + VirtualMachinesRunCommandResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesRunCommandResult contains the result from method VirtualMachines.RunCommand. +type VirtualMachinesRunCommandResult struct { + RunCommandResult +} + +// VirtualMachinesSimulateEvictionResponse contains the response from method VirtualMachines.SimulateEviction. +type VirtualMachinesSimulateEvictionResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesStartPollerResponse contains the response from method VirtualMachines.Start. +type VirtualMachinesStartPollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesStartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesStartResponse, error) { + respType := VirtualMachinesStartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesStartPollerResponse from the provided client and resume token. +func (l *VirtualMachinesStartPollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Start", token, client.pl, client.startHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesStartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesStartResponse contains the response from method VirtualMachines.Start. +type VirtualMachinesStartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// VirtualMachinesUpdatePollerResponse contains the response from method VirtualMachines.Update. +type VirtualMachinesUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *VirtualMachinesUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +func (l VirtualMachinesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesUpdateResponse, error) { + respType := VirtualMachinesUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachine) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a VirtualMachinesUpdatePollerResponse from the provided client and resume token. +func (l *VirtualMachinesUpdatePollerResponse) Resume(ctx context.Context, client *VirtualMachinesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("VirtualMachinesClient.Update", token, client.pl, client.updateHandleError) + if err != nil { + return err + } + poller := &VirtualMachinesUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// VirtualMachinesUpdateResponse contains the response from method VirtualMachines.Update. +type VirtualMachinesUpdateResponse struct { + VirtualMachinesUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} - // The List Virtual Machine operation response. - VirtualMachineSizeListResult *VirtualMachineSizeListResult +// VirtualMachinesUpdateResult contains the result from method VirtualMachines.Update. +type VirtualMachinesUpdateResult struct { + VirtualMachine } diff --git a/sdk/compute/armcompute/zz_generated_restorepointcollections_client.go b/sdk/compute/armcompute/zz_generated_restorepointcollections_client.go index 7e53bd6b03a1..1b6194df7902 100644 --- a/sdk/compute/armcompute/zz_generated_restorepointcollections_client.go +++ b/sdk/compute/armcompute/zz_generated_restorepointcollections_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,46 +12,49 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // RestorePointCollectionsClient contains the methods for the RestorePointCollections group. // Don't use this type directly, use NewRestorePointCollectionsClient() instead. type RestorePointCollectionsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewRestorePointCollectionsClient creates a new instance of RestorePointCollectionsClient with the specified values. -func NewRestorePointCollectionsClient(con *armcore.Connection, subscriptionID string) *RestorePointCollectionsClient { - return &RestorePointCollectionsClient{con: con, subscriptionID: subscriptionID} +func NewRestorePointCollectionsClient(con *arm.Connection, subscriptionID string) *RestorePointCollectionsClient { + return &RestorePointCollectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // CreateOrUpdate - The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for more details. When // updating a restore point collection, only tags may be modified. // If the operation fails it returns the *CloudError error type. -func (client *RestorePointCollectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollection, options *RestorePointCollectionsCreateOrUpdateOptions) (RestorePointCollectionResponse, error) { +func (client *RestorePointCollectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollection, options *RestorePointCollectionsCreateOrUpdateOptions) (RestorePointCollectionsCreateOrUpdateResponse, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, restorePointCollectionName, parameters, options) if err != nil { - return RestorePointCollectionResponse{}, err + return RestorePointCollectionsCreateOrUpdateResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RestorePointCollectionResponse{}, err + return RestorePointCollectionsCreateOrUpdateResponse{}, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { - return RestorePointCollectionResponse{}, client.createOrUpdateHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return RestorePointCollectionsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) } return client.createOrUpdateHandleResponse(resp) } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *RestorePointCollectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollection, options *RestorePointCollectionsCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *RestorePointCollectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollection, options *RestorePointCollectionsCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -64,107 +68,78 @@ func (client *RestorePointCollectionsClient) createOrUpdateCreateRequest(ctx con return nil, errors.New("parameter restorePointCollectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *RestorePointCollectionsClient) createOrUpdateHandleResponse(resp *azcore.Response) (RestorePointCollectionResponse, error) { - var val *RestorePointCollection - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RestorePointCollectionResponse{}, err +func (client *RestorePointCollectionsClient) createOrUpdateHandleResponse(resp *http.Response) (RestorePointCollectionsCreateOrUpdateResponse, error) { + result := RestorePointCollectionsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollection); err != nil { + return RestorePointCollectionsCreateOrUpdateResponse{}, err } - return RestorePointCollectionResponse{RawResponse: resp.Response, RestorePointCollection: val}, nil + return result, nil } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *RestorePointCollectionsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *RestorePointCollectionsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - The operation to delete the restore point collection. This operation will also delete all the contained restore points. // If the operation fails it returns the *CloudError error type. -func (client *RestorePointCollectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *RestorePointCollectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsBeginDeleteOptions) (RestorePointCollectionsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, restorePointCollectionName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("RestorePointCollectionsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return RestorePointCollectionsDeletePollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := RestorePointCollectionsDeletePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *RestorePointCollectionsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("RestorePointCollectionsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("RestorePointCollectionsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return RestorePointCollectionsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &RestorePointCollectionsDeletePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - The operation to delete the restore point collection. This operation will also delete all the contained restore points. // If the operation fails it returns the *CloudError error type. -func (client *RestorePointCollectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsBeginDeleteOptions) (*azcore.Response, error) { +func (client *RestorePointCollectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, restorePointCollectionName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *RestorePointCollectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsBeginDeleteOptions) (*azcore.Request, error) { +func (client *RestorePointCollectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -178,50 +153,49 @@ func (client *RestorePointCollectionsClient) deleteCreateRequest(ctx context.Con return nil, errors.New("parameter restorePointCollectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *RestorePointCollectionsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *RestorePointCollectionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - The operation to get the restore point collection. // If the operation fails it returns the *CloudError error type. -func (client *RestorePointCollectionsClient) Get(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsGetOptions) (RestorePointCollectionResponse, error) { +func (client *RestorePointCollectionsClient) Get(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsGetOptions) (RestorePointCollectionsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, restorePointCollectionName, options) if err != nil { - return RestorePointCollectionResponse{}, err + return RestorePointCollectionsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RestorePointCollectionResponse{}, err + return RestorePointCollectionsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return RestorePointCollectionResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RestorePointCollectionsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *RestorePointCollectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsGetOptions) (*azcore.Request, error) { +func (client *RestorePointCollectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, options *RestorePointCollectionsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -235,62 +209,58 @@ func (client *RestorePointCollectionsClient) getCreateRequest(ctx context.Contex return nil, errors.New("parameter restorePointCollectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *RestorePointCollectionsClient) getHandleResponse(resp *azcore.Response) (RestorePointCollectionResponse, error) { - var val *RestorePointCollection - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RestorePointCollectionResponse{}, err +func (client *RestorePointCollectionsClient) getHandleResponse(resp *http.Response) (RestorePointCollectionsGetResponse, error) { + result := RestorePointCollectionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollection); err != nil { + return RestorePointCollectionsGetResponse{}, err } - return RestorePointCollectionResponse{RawResponse: resp.Response, RestorePointCollection: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *RestorePointCollectionsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *RestorePointCollectionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - Gets the list of restore point collections in a resource group. // If the operation fails it returns the *CloudError error type. -func (client *RestorePointCollectionsClient) List(resourceGroupName string, options *RestorePointCollectionsListOptions) RestorePointCollectionListResultPager { - return &restorePointCollectionListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *RestorePointCollectionsClient) List(resourceGroupName string, options *RestorePointCollectionsListOptions) *RestorePointCollectionsListPager { + return &RestorePointCollectionsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp RestorePointCollectionListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.RestorePointCollectionListResult.NextLink) + advancer: func(ctx context.Context, resp RestorePointCollectionsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.RestorePointCollectionListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *RestorePointCollectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *RestorePointCollectionsListOptions) (*azcore.Request, error) { +func (client *RestorePointCollectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *RestorePointCollectionsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -300,119 +270,114 @@ func (client *RestorePointCollectionsClient) listCreateRequest(ctx context.Conte return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *RestorePointCollectionsClient) listHandleResponse(resp *azcore.Response) (RestorePointCollectionListResultResponse, error) { - var val *RestorePointCollectionListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RestorePointCollectionListResultResponse{}, err +func (client *RestorePointCollectionsClient) listHandleResponse(resp *http.Response) (RestorePointCollectionsListResponse, error) { + result := RestorePointCollectionsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollectionListResult); err != nil { + return RestorePointCollectionsListResponse{}, err } - return RestorePointCollectionListResultResponse{RawResponse: resp.Response, RestorePointCollectionListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *RestorePointCollectionsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *RestorePointCollectionsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListAll - Gets the list of restore point collections in the subscription. Use nextLink property in the response to get the next page of restore point // collections. Do this till nextLink is not null to fetch all // the restore point collections. // If the operation fails it returns the *CloudError error type. -func (client *RestorePointCollectionsClient) ListAll(options *RestorePointCollectionsListAllOptions) RestorePointCollectionListResultPager { - return &restorePointCollectionListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *RestorePointCollectionsClient) ListAll(options *RestorePointCollectionsListAllOptions) *RestorePointCollectionsListAllPager { + return &RestorePointCollectionsListAllPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listAllCreateRequest(ctx, options) }, - responder: client.listAllHandleResponse, - errorer: client.listAllHandleError, - advancer: func(ctx context.Context, resp RestorePointCollectionListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.RestorePointCollectionListResult.NextLink) + advancer: func(ctx context.Context, resp RestorePointCollectionsListAllResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.RestorePointCollectionListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listAllCreateRequest creates the ListAll request. -func (client *RestorePointCollectionsClient) listAllCreateRequest(ctx context.Context, options *RestorePointCollectionsListAllOptions) (*azcore.Request, error) { +func (client *RestorePointCollectionsClient) listAllCreateRequest(ctx context.Context, options *RestorePointCollectionsListAllOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/restorePointCollections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listAllHandleResponse handles the ListAll response. -func (client *RestorePointCollectionsClient) listAllHandleResponse(resp *azcore.Response) (RestorePointCollectionListResultResponse, error) { - var val *RestorePointCollectionListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RestorePointCollectionListResultResponse{}, err +func (client *RestorePointCollectionsClient) listAllHandleResponse(resp *http.Response) (RestorePointCollectionsListAllResponse, error) { + result := RestorePointCollectionsListAllResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollectionListResult); err != nil { + return RestorePointCollectionsListAllResponse{}, err } - return RestorePointCollectionListResultResponse{RawResponse: resp.Response, RestorePointCollectionListResult: val}, nil + return result, nil } // listAllHandleError handles the ListAll error response. -func (client *RestorePointCollectionsClient) listAllHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *RestorePointCollectionsClient) listAllHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Update - The operation to update the restore point collection. // If the operation fails it returns the *CloudError error type. -func (client *RestorePointCollectionsClient) Update(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollectionUpdate, options *RestorePointCollectionsUpdateOptions) (RestorePointCollectionResponse, error) { +func (client *RestorePointCollectionsClient) Update(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollectionUpdate, options *RestorePointCollectionsUpdateOptions) (RestorePointCollectionsUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, restorePointCollectionName, parameters, options) if err != nil { - return RestorePointCollectionResponse{}, err + return RestorePointCollectionsUpdateResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RestorePointCollectionResponse{}, err + return RestorePointCollectionsUpdateResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return RestorePointCollectionResponse{}, client.updateHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RestorePointCollectionsUpdateResponse{}, client.updateHandleError(resp) } return client.updateHandleResponse(resp) } // updateCreateRequest creates the Update request. -func (client *RestorePointCollectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollectionUpdate, options *RestorePointCollectionsUpdateOptions) (*azcore.Request, error) { +func (client *RestorePointCollectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, parameters RestorePointCollectionUpdate, options *RestorePointCollectionsUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -426,36 +391,35 @@ func (client *RestorePointCollectionsClient) updateCreateRequest(ctx context.Con return nil, errors.New("parameter restorePointCollectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{restorePointCollectionName}", url.PathEscape(restorePointCollectionName)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // updateHandleResponse handles the Update response. -func (client *RestorePointCollectionsClient) updateHandleResponse(resp *azcore.Response) (RestorePointCollectionResponse, error) { - var val *RestorePointCollection - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RestorePointCollectionResponse{}, err +func (client *RestorePointCollectionsClient) updateHandleResponse(resp *http.Response) (RestorePointCollectionsUpdateResponse, error) { + result := RestorePointCollectionsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollection); err != nil { + return RestorePointCollectionsUpdateResponse{}, err } - return RestorePointCollectionResponse{RawResponse: resp.Response, RestorePointCollection: val}, nil + return result, nil } // updateHandleError handles the Update error response. -func (client *RestorePointCollectionsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *RestorePointCollectionsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_restorepoints_client.go b/sdk/compute/armcompute/zz_generated_restorepoints_client.go index 62df2f47997e..b7cb39f4f94d 100644 --- a/sdk/compute/armcompute/zz_generated_restorepoints_client.go +++ b/sdk/compute/armcompute/zz_generated_restorepoints_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // RestorePointsClient contains the methods for the RestorePoints group. // Don't use this type directly, use NewRestorePointsClient() instead. type RestorePointsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewRestorePointsClient creates a new instance of RestorePointsClient with the specified values. -func NewRestorePointsClient(con *armcore.Connection, subscriptionID string) *RestorePointsClient { - return &RestorePointsClient{con: con, subscriptionID: subscriptionID} +func NewRestorePointsClient(con *arm.Connection, subscriptionID string) *RestorePointsClient { + return &RestorePointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreate - The operation to create the restore point. Updating properties of an existing restore point is not allowed // If the operation fails it returns the *CloudError error type. -func (client *RestorePointsClient) BeginCreate(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsBeginCreateOptions) (RestorePointPollerResponse, error) { +func (client *RestorePointsClient) BeginCreate(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsBeginCreateOptions) (RestorePointsCreatePollerResponse, error) { resp, err := client.create(ctx, resourceGroupName, restorePointCollectionName, restorePointName, parameters, options) if err != nil { - return RestorePointPollerResponse{}, err + return RestorePointsCreatePollerResponse{}, err } - result := RestorePointPollerResponse{ - RawResponse: resp.Response, + result := RestorePointsCreatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("RestorePointsClient.Create", "", resp, client.con.Pipeline(), client.createHandleError) + pt, err := armruntime.NewPoller("RestorePointsClient.Create", "", resp, client.pl, client.createHandleError) if err != nil { - return RestorePointPollerResponse{}, err + return RestorePointsCreatePollerResponse{}, err } - poller := &restorePointPoller{ + result.Poller = &RestorePointsCreatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (RestorePointResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreate creates a new RestorePointPoller from the specified resume token. -// token - The value must come from a previous call to RestorePointPoller.ResumeToken(). -func (client *RestorePointsClient) ResumeCreate(ctx context.Context, token string) (RestorePointPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("RestorePointsClient.Create", token, client.con.Pipeline(), client.createHandleError) - if err != nil { - return RestorePointPollerResponse{}, err - } - poller := &restorePointPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return RestorePointPollerResponse{}, err - } - result := RestorePointPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (RestorePointResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Create - The operation to create the restore point. Updating properties of an existing restore point is not allowed // If the operation fails it returns the *CloudError error type. -func (client *RestorePointsClient) create(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsBeginCreateOptions) (*azcore.Response, error) { +func (client *RestorePointsClient) create(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsBeginCreateOptions) (*http.Response, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusCreated) { return nil, client.createHandleError(resp) } return resp, nil } // createCreateRequest creates the Create request. -func (client *RestorePointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsBeginCreateOptions) (*azcore.Request, error) { +func (client *RestorePointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, parameters RestorePoint, options *RestorePointsBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,98 +91,69 @@ func (client *RestorePointsClient) createCreateRequest(ctx context.Context, reso return nil, errors.New("parameter restorePointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{restorePointName}", url.PathEscape(restorePointName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // createHandleError handles the Create error response. -func (client *RestorePointsClient) createHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *RestorePointsClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - The operation to delete the restore point. // If the operation fails it returns the *CloudError error type. -func (client *RestorePointsClient) BeginDelete(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *RestorePointsClient) BeginDelete(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsBeginDeleteOptions) (RestorePointsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, restorePointCollectionName, restorePointName, options) if err != nil { - return HTTPPollerResponse{}, err + return RestorePointsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := RestorePointsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("RestorePointsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("RestorePointsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return RestorePointsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &RestorePointsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *RestorePointsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("RestorePointsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - The operation to delete the restore point. // If the operation fails it returns the *CloudError error type. -func (client *RestorePointsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsBeginDeleteOptions) (*azcore.Response, error) { +func (client *RestorePointsClient) deleteOperation(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsBeginDeleteOptions) (*azcore.Request, error) { +func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -224,50 +171,49 @@ func (client *RestorePointsClient) deleteCreateRequest(ctx context.Context, reso return nil, errors.New("parameter restorePointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{restorePointName}", url.PathEscape(restorePointName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *RestorePointsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *RestorePointsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - The operation to get the restore point. // If the operation fails it returns the *CloudError error type. -func (client *RestorePointsClient) Get(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsGetOptions) (RestorePointResponse, error) { +func (client *RestorePointsClient) Get(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsGetOptions) (RestorePointsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, restorePointCollectionName, restorePointName, options) if err != nil { - return RestorePointResponse{}, err + return RestorePointsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RestorePointResponse{}, err + return RestorePointsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return RestorePointResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RestorePointsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *RestorePointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsGetOptions) (*azcore.Request, error) { +func (client *RestorePointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, restorePointCollectionName string, restorePointName string, options *RestorePointsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/restorePointCollections/{restorePointCollectionName}/restorePoints/{restorePointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -285,36 +231,35 @@ func (client *RestorePointsClient) getCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter restorePointName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{restorePointName}", url.PathEscape(restorePointName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *RestorePointsClient) getHandleResponse(resp *azcore.Response) (RestorePointResponse, error) { - var val *RestorePoint - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RestorePointResponse{}, err +func (client *RestorePointsClient) getHandleResponse(resp *http.Response) (RestorePointsGetResponse, error) { + result := RestorePointsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RestorePoint); err != nil { + return RestorePointsGetResponse{}, err } - return RestorePointResponse{RawResponse: resp.Response, RestorePoint: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *RestorePointsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *RestorePointsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_sharedgalleries_client.go b/sdk/compute/armcompute/zz_generated_sharedgalleries_client.go index 2a068ee8364a..f26c241ee61d 100644 --- a/sdk/compute/armcompute/zz_generated_sharedgalleries_client.go +++ b/sdk/compute/armcompute/zz_generated_sharedgalleries_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,44 +12,47 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // SharedGalleriesClient contains the methods for the SharedGalleries group. // Don't use this type directly, use NewSharedGalleriesClient() instead. type SharedGalleriesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewSharedGalleriesClient creates a new instance of SharedGalleriesClient with the specified values. -func NewSharedGalleriesClient(con *armcore.Connection, subscriptionID string) *SharedGalleriesClient { - return &SharedGalleriesClient{con: con, subscriptionID: subscriptionID} +func NewSharedGalleriesClient(con *arm.Connection, subscriptionID string) *SharedGalleriesClient { + return &SharedGalleriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // Get - Get a shared gallery by subscription id or tenant id. // If the operation fails it returns the *CloudError error type. -func (client *SharedGalleriesClient) Get(ctx context.Context, location string, galleryUniqueName string, options *SharedGalleriesGetOptions) (SharedGalleryResponse, error) { +func (client *SharedGalleriesClient) Get(ctx context.Context, location string, galleryUniqueName string, options *SharedGalleriesGetOptions) (SharedGalleriesGetResponse, error) { req, err := client.getCreateRequest(ctx, location, galleryUniqueName, options) if err != nil { - return SharedGalleryResponse{}, err + return SharedGalleriesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return SharedGalleryResponse{}, err + return SharedGalleriesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return SharedGalleryResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharedGalleriesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *SharedGalleriesClient) getCreateRequest(ctx context.Context, location string, galleryUniqueName string, options *SharedGalleriesGetOptions) (*azcore.Request, error) { +func (client *SharedGalleriesClient) getCreateRequest(ctx context.Context, location string, galleryUniqueName string, options *SharedGalleriesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -62,59 +66,55 @@ func (client *SharedGalleriesClient) getCreateRequest(ctx context.Context, locat return nil, errors.New("parameter galleryUniqueName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryUniqueName}", url.PathEscape(galleryUniqueName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *SharedGalleriesClient) getHandleResponse(resp *azcore.Response) (SharedGalleryResponse, error) { - var val *SharedGallery - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SharedGalleryResponse{}, err +func (client *SharedGalleriesClient) getHandleResponse(resp *http.Response) (SharedGalleriesGetResponse, error) { + result := SharedGalleriesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGallery); err != nil { + return SharedGalleriesGetResponse{}, err } - return SharedGalleryResponse{RawResponse: resp.Response, SharedGallery: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *SharedGalleriesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SharedGalleriesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - List shared galleries by subscription id or tenant id. // If the operation fails it returns the *CloudError error type. -func (client *SharedGalleriesClient) List(location string, options *SharedGalleriesListOptions) SharedGalleryListPager { - return &sharedGalleryListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *SharedGalleriesClient) List(location string, options *SharedGalleriesListOptions) *SharedGalleriesListPager { + return &SharedGalleriesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, location, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp SharedGalleryListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.SharedGalleryList.NextLink) + advancer: func(ctx context.Context, resp SharedGalleriesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SharedGalleryList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *SharedGalleriesClient) listCreateRequest(ctx context.Context, location string, options *SharedGalleriesListOptions) (*azcore.Request, error) { +func (client *SharedGalleriesClient) listCreateRequest(ctx context.Context, location string, options *SharedGalleriesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -124,39 +124,38 @@ func (client *SharedGalleriesClient) listCreateRequest(ctx context.Context, loca return nil, errors.New("parameter location cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") if options != nil && options.SharedTo != nil { reqQP.Set("sharedTo", string(*options.SharedTo)) } - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *SharedGalleriesClient) listHandleResponse(resp *azcore.Response) (SharedGalleryListResponse, error) { - var val *SharedGalleryList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SharedGalleryListResponse{}, err +func (client *SharedGalleriesClient) listHandleResponse(resp *http.Response) (SharedGalleriesListResponse, error) { + result := SharedGalleriesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryList); err != nil { + return SharedGalleriesListResponse{}, err } - return SharedGalleryListResponse{RawResponse: resp.Response, SharedGalleryList: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *SharedGalleriesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SharedGalleriesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_sharedgalleryimages_client.go b/sdk/compute/armcompute/zz_generated_sharedgalleryimages_client.go index 3e918c284d12..3b251dda8246 100644 --- a/sdk/compute/armcompute/zz_generated_sharedgalleryimages_client.go +++ b/sdk/compute/armcompute/zz_generated_sharedgalleryimages_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,44 +12,47 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // SharedGalleryImagesClient contains the methods for the SharedGalleryImages group. // Don't use this type directly, use NewSharedGalleryImagesClient() instead. type SharedGalleryImagesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewSharedGalleryImagesClient creates a new instance of SharedGalleryImagesClient with the specified values. -func NewSharedGalleryImagesClient(con *armcore.Connection, subscriptionID string) *SharedGalleryImagesClient { - return &SharedGalleryImagesClient{con: con, subscriptionID: subscriptionID} +func NewSharedGalleryImagesClient(con *arm.Connection, subscriptionID string) *SharedGalleryImagesClient { + return &SharedGalleryImagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // Get - Get a shared gallery image by subscription id or tenant id. // If the operation fails it returns the *CloudError error type. -func (client *SharedGalleryImagesClient) Get(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImagesGetOptions) (SharedGalleryImageResponse, error) { +func (client *SharedGalleryImagesClient) Get(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImagesGetOptions) (SharedGalleryImagesGetResponse, error) { req, err := client.getCreateRequest(ctx, location, galleryUniqueName, galleryImageName, options) if err != nil { - return SharedGalleryImageResponse{}, err + return SharedGalleryImagesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return SharedGalleryImageResponse{}, err + return SharedGalleryImagesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return SharedGalleryImageResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharedGalleryImagesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *SharedGalleryImagesClient) getCreateRequest(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImagesGetOptions) (*azcore.Request, error) { +func (client *SharedGalleryImagesClient) getCreateRequest(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImagesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -66,59 +70,55 @@ func (client *SharedGalleryImagesClient) getCreateRequest(ctx context.Context, l return nil, errors.New("parameter galleryImageName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *SharedGalleryImagesClient) getHandleResponse(resp *azcore.Response) (SharedGalleryImageResponse, error) { - var val *SharedGalleryImage - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SharedGalleryImageResponse{}, err +func (client *SharedGalleryImagesClient) getHandleResponse(resp *http.Response) (SharedGalleryImagesGetResponse, error) { + result := SharedGalleryImagesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImage); err != nil { + return SharedGalleryImagesGetResponse{}, err } - return SharedGalleryImageResponse{RawResponse: resp.Response, SharedGalleryImage: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *SharedGalleryImagesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SharedGalleryImagesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - List shared gallery images by subscription id or tenant id. // If the operation fails it returns the *CloudError error type. -func (client *SharedGalleryImagesClient) List(location string, galleryUniqueName string, options *SharedGalleryImagesListOptions) SharedGalleryImageListPager { - return &sharedGalleryImageListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *SharedGalleryImagesClient) List(location string, galleryUniqueName string, options *SharedGalleryImagesListOptions) *SharedGalleryImagesListPager { + return &SharedGalleryImagesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, location, galleryUniqueName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp SharedGalleryImageListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.SharedGalleryImageList.NextLink) + advancer: func(ctx context.Context, resp SharedGalleryImagesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SharedGalleryImageList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *SharedGalleryImagesClient) listCreateRequest(ctx context.Context, location string, galleryUniqueName string, options *SharedGalleryImagesListOptions) (*azcore.Request, error) { +func (client *SharedGalleryImagesClient) listCreateRequest(ctx context.Context, location string, galleryUniqueName string, options *SharedGalleryImagesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -132,39 +132,38 @@ func (client *SharedGalleryImagesClient) listCreateRequest(ctx context.Context, return nil, errors.New("parameter galleryUniqueName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryUniqueName}", url.PathEscape(galleryUniqueName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") if options != nil && options.SharedTo != nil { reqQP.Set("sharedTo", string(*options.SharedTo)) } - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *SharedGalleryImagesClient) listHandleResponse(resp *azcore.Response) (SharedGalleryImageListResponse, error) { - var val *SharedGalleryImageList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SharedGalleryImageListResponse{}, err +func (client *SharedGalleryImagesClient) listHandleResponse(resp *http.Response) (SharedGalleryImagesListResponse, error) { + result := SharedGalleryImagesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImageList); err != nil { + return SharedGalleryImagesListResponse{}, err } - return SharedGalleryImageListResponse{RawResponse: resp.Response, SharedGalleryImageList: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *SharedGalleryImagesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SharedGalleryImagesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_sharedgalleryimageversions_client.go b/sdk/compute/armcompute/zz_generated_sharedgalleryimageversions_client.go index 94ac6df490bf..7b6aef7276ea 100644 --- a/sdk/compute/armcompute/zz_generated_sharedgalleryimageversions_client.go +++ b/sdk/compute/armcompute/zz_generated_sharedgalleryimageversions_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,44 +12,47 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // SharedGalleryImageVersionsClient contains the methods for the SharedGalleryImageVersions group. // Don't use this type directly, use NewSharedGalleryImageVersionsClient() instead. type SharedGalleryImageVersionsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewSharedGalleryImageVersionsClient creates a new instance of SharedGalleryImageVersionsClient with the specified values. -func NewSharedGalleryImageVersionsClient(con *armcore.Connection, subscriptionID string) *SharedGalleryImageVersionsClient { - return &SharedGalleryImageVersionsClient{con: con, subscriptionID: subscriptionID} +func NewSharedGalleryImageVersionsClient(con *arm.Connection, subscriptionID string) *SharedGalleryImageVersionsClient { + return &SharedGalleryImageVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // Get - Get a shared gallery image version by subscription id or tenant id. // If the operation fails it returns the *CloudError error type. -func (client *SharedGalleryImageVersionsClient) Get(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, galleryImageVersionName string, options *SharedGalleryImageVersionsGetOptions) (SharedGalleryImageVersionResponse, error) { +func (client *SharedGalleryImageVersionsClient) Get(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, galleryImageVersionName string, options *SharedGalleryImageVersionsGetOptions) (SharedGalleryImageVersionsGetResponse, error) { req, err := client.getCreateRequest(ctx, location, galleryUniqueName, galleryImageName, galleryImageVersionName, options) if err != nil { - return SharedGalleryImageVersionResponse{}, err + return SharedGalleryImageVersionsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return SharedGalleryImageVersionResponse{}, err + return SharedGalleryImageVersionsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return SharedGalleryImageVersionResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SharedGalleryImageVersionsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *SharedGalleryImageVersionsClient) getCreateRequest(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, galleryImageVersionName string, options *SharedGalleryImageVersionsGetOptions) (*azcore.Request, error) { +func (client *SharedGalleryImageVersionsClient) getCreateRequest(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, galleryImageVersionName string, options *SharedGalleryImageVersionsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions/{galleryImageVersionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -70,59 +74,55 @@ func (client *SharedGalleryImageVersionsClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter galleryImageVersionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *SharedGalleryImageVersionsClient) getHandleResponse(resp *azcore.Response) (SharedGalleryImageVersionResponse, error) { - var val *SharedGalleryImageVersion - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SharedGalleryImageVersionResponse{}, err +func (client *SharedGalleryImageVersionsClient) getHandleResponse(resp *http.Response) (SharedGalleryImageVersionsGetResponse, error) { + result := SharedGalleryImageVersionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImageVersion); err != nil { + return SharedGalleryImageVersionsGetResponse{}, err } - return SharedGalleryImageVersionResponse{RawResponse: resp.Response, SharedGalleryImageVersion: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *SharedGalleryImageVersionsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SharedGalleryImageVersionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - List shared gallery image versions by subscription id or tenant id. // If the operation fails it returns the *CloudError error type. -func (client *SharedGalleryImageVersionsClient) List(location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImageVersionsListOptions) SharedGalleryImageVersionListPager { - return &sharedGalleryImageVersionListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *SharedGalleryImageVersionsClient) List(location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImageVersionsListOptions) *SharedGalleryImageVersionsListPager { + return &SharedGalleryImageVersionsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, location, galleryUniqueName, galleryImageName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp SharedGalleryImageVersionListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.SharedGalleryImageVersionList.NextLink) + advancer: func(ctx context.Context, resp SharedGalleryImageVersionsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SharedGalleryImageVersionList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *SharedGalleryImageVersionsClient) listCreateRequest(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImageVersionsListOptions) (*azcore.Request, error) { +func (client *SharedGalleryImageVersionsClient) listCreateRequest(ctx context.Context, location string, galleryUniqueName string, galleryImageName string, options *SharedGalleryImageVersionsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/sharedGalleries/{galleryUniqueName}/images/{galleryImageName}/versions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -140,39 +140,38 @@ func (client *SharedGalleryImageVersionsClient) listCreateRequest(ctx context.Co return nil, errors.New("parameter galleryImageName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2020-09-30") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") if options != nil && options.SharedTo != nil { reqQP.Set("sharedTo", string(*options.SharedTo)) } - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *SharedGalleryImageVersionsClient) listHandleResponse(resp *azcore.Response) (SharedGalleryImageVersionListResponse, error) { - var val *SharedGalleryImageVersionList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SharedGalleryImageVersionListResponse{}, err +func (client *SharedGalleryImageVersionsClient) listHandleResponse(resp *http.Response) (SharedGalleryImageVersionsListResponse, error) { + result := SharedGalleryImageVersionsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImageVersionList); err != nil { + return SharedGalleryImageVersionsListResponse{}, err } - return SharedGalleryImageVersionListResponse{RawResponse: resp.Response, SharedGalleryImageVersionList: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *SharedGalleryImageVersionsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SharedGalleryImageVersionsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_snapshots_client.go b/sdk/compute/armcompute/zz_generated_snapshots_client.go index 72f535eb132b..185d331ef9ce 100644 --- a/sdk/compute/armcompute/zz_generated_snapshots_client.go +++ b/sdk/compute/armcompute/zz_generated_snapshots_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,93 +11,68 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // SnapshotsClient contains the methods for the Snapshots group. // Don't use this type directly, use NewSnapshotsClient() instead. type SnapshotsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewSnapshotsClient creates a new instance of SnapshotsClient with the specified values. -func NewSnapshotsClient(con *armcore.Connection, subscriptionID string) *SnapshotsClient { - return &SnapshotsClient{con: con, subscriptionID: subscriptionID} +func NewSnapshotsClient(con *arm.Connection, subscriptionID string) *SnapshotsClient { + return &SnapshotsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - Creates or updates a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot, options *SnapshotsBeginCreateOrUpdateOptions) (SnapshotPollerResponse, error) { +func (client *SnapshotsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot, options *SnapshotsBeginCreateOrUpdateOptions) (SnapshotsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, snapshotName, snapshot, options) if err != nil { - return SnapshotPollerResponse{}, err + return SnapshotsCreateOrUpdatePollerResponse{}, err } - result := SnapshotPollerResponse{ - RawResponse: resp.Response, + result := SnapshotsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("SnapshotsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("SnapshotsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return SnapshotPollerResponse{}, err + return SnapshotsCreateOrUpdatePollerResponse{}, err } - poller := &snapshotPoller{ + result.Poller = &SnapshotsCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (SnapshotResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new SnapshotPoller from the specified resume token. -// token - The value must come from a previous call to SnapshotPoller.ResumeToken(). -func (client *SnapshotsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (SnapshotPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("SnapshotsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return SnapshotPollerResponse{}, err - } - poller := &snapshotPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return SnapshotPollerResponse{}, err - } - result := SnapshotPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (SnapshotResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Creates or updates a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) createOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot, options *SnapshotsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *SnapshotsClient) createOrUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot, options *SnapshotsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, snapshotName, snapshot, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot, options *SnapshotsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *SnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, snapshot Snapshot, options *SnapshotsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -110,97 +86,68 @@ func (client *SnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter snapshotName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(snapshot) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, snapshot) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *SnapshotsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SnapshotsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDelete - Deletes a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) BeginDelete(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *SnapshotsClient) BeginDelete(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginDeleteOptions) (SnapshotsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, snapshotName, options) if err != nil { - return HTTPPollerResponse{}, err + return SnapshotsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("SnapshotsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := SnapshotsDeletePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *SnapshotsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("SnapshotsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("SnapshotsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return SnapshotsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &SnapshotsDeletePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Deletes a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) deleteOperation(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginDeleteOptions) (*azcore.Response, error) { +func (client *SnapshotsClient) deleteOperation(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, snapshotName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginDeleteOptions) (*azcore.Request, error) { +func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -214,48 +161,47 @@ func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resource return nil, errors.New("parameter snapshotName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *SnapshotsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SnapshotsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Gets information about a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) Get(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsGetOptions) (SnapshotResponse, error) { +func (client *SnapshotsClient) Get(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsGetOptions) (SnapshotsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, snapshotName, options) if err != nil { - return SnapshotResponse{}, err + return SnapshotsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return SnapshotResponse{}, err + return SnapshotsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return SnapshotResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SnapshotsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsGetOptions) (*azcore.Request, error) { +func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -269,106 +215,77 @@ func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter snapshotName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *SnapshotsClient) getHandleResponse(resp *azcore.Response) (SnapshotResponse, error) { - var val *Snapshot - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SnapshotResponse{}, err +func (client *SnapshotsClient) getHandleResponse(resp *http.Response) (SnapshotsGetResponse, error) { + result := SnapshotsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { + return SnapshotsGetResponse{}, err } - return SnapshotResponse{RawResponse: resp.Response, Snapshot: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *SnapshotsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SnapshotsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginGrantAccess - Grants access to a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) BeginGrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, options *SnapshotsBeginGrantAccessOptions) (AccessURIPollerResponse, error) { +func (client *SnapshotsClient) BeginGrantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, options *SnapshotsBeginGrantAccessOptions) (SnapshotsGrantAccessPollerResponse, error) { resp, err := client.grantAccess(ctx, resourceGroupName, snapshotName, grantAccessData, options) if err != nil { - return AccessURIPollerResponse{}, err - } - result := AccessURIPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("SnapshotsClient.GrantAccess", "location", resp, client.con.Pipeline(), client.grantAccessHandleError) - if err != nil { - return AccessURIPollerResponse{}, err + return SnapshotsGrantAccessPollerResponse{}, err } - poller := &accessURIPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (AccessURIResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := SnapshotsGrantAccessPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeGrantAccess creates a new AccessURIPoller from the specified resume token. -// token - The value must come from a previous call to AccessURIPoller.ResumeToken(). -func (client *SnapshotsClient) ResumeGrantAccess(ctx context.Context, token string) (AccessURIPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("SnapshotsClient.GrantAccess", token, client.con.Pipeline(), client.grantAccessHandleError) + pt, err := armruntime.NewPoller("SnapshotsClient.GrantAccess", "location", resp, client.pl, client.grantAccessHandleError) if err != nil { - return AccessURIPollerResponse{}, err + return SnapshotsGrantAccessPollerResponse{}, err } - poller := &accessURIPoller{ + result.Poller = &SnapshotsGrantAccessPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return AccessURIPollerResponse{}, err - } - result := AccessURIPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (AccessURIResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // GrantAccess - Grants access to a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) grantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, options *SnapshotsBeginGrantAccessOptions) (*azcore.Response, error) { +func (client *SnapshotsClient) grantAccess(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, options *SnapshotsBeginGrantAccessOptions) (*http.Response, error) { req, err := client.grantAccessCreateRequest(ctx, resourceGroupName, snapshotName, grantAccessData, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.grantAccessHandleError(resp) } return resp, nil } // grantAccessCreateRequest creates the GrantAccess request. -func (client *SnapshotsClient) grantAccessCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, options *SnapshotsBeginGrantAccessOptions) (*azcore.Request, error) { +func (client *SnapshotsClient) grantAccessCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, grantAccessData GrantAccessData, options *SnapshotsBeginGrantAccessOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/beginGetAccess" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -382,106 +299,98 @@ func (client *SnapshotsClient) grantAccessCreateRequest(ctx context.Context, res return nil, errors.New("parameter snapshotName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(grantAccessData) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, grantAccessData) } // grantAccessHandleError handles the GrantAccess error response. -func (client *SnapshotsClient) grantAccessHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SnapshotsClient) grantAccessHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - Lists snapshots under a subscription. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) List(options *SnapshotsListOptions) SnapshotListPager { - return &snapshotListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *SnapshotsClient) List(options *SnapshotsListOptions) *SnapshotsListPager { + return &SnapshotsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp SnapshotListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.SnapshotList.NextLink) + advancer: func(ctx context.Context, resp SnapshotsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SnapshotList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *SnapshotsClient) listCreateRequest(ctx context.Context, options *SnapshotsListOptions) (*azcore.Request, error) { +func (client *SnapshotsClient) listCreateRequest(ctx context.Context, options *SnapshotsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/snapshots" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *SnapshotsClient) listHandleResponse(resp *azcore.Response) (SnapshotListResponse, error) { - var val *SnapshotList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SnapshotListResponse{}, err +func (client *SnapshotsClient) listHandleResponse(resp *http.Response) (SnapshotsListResponse, error) { + result := SnapshotsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotList); err != nil { + return SnapshotsListResponse{}, err } - return SnapshotListResponse{RawResponse: resp.Response, SnapshotList: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *SnapshotsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SnapshotsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListByResourceGroup - Lists snapshots under a resource group. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) ListByResourceGroup(resourceGroupName string, options *SnapshotsListByResourceGroupOptions) SnapshotListPager { - return &snapshotListPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *SnapshotsClient) ListByResourceGroup(resourceGroupName string, options *SnapshotsListByResourceGroupOptions) *SnapshotsListByResourceGroupPager { + return &SnapshotsListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listByResourceGroupHandleResponse, - errorer: client.listByResourceGroupHandleError, - advancer: func(ctx context.Context, resp SnapshotListResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.SnapshotList.NextLink) + advancer: func(ctx context.Context, resp SnapshotsListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SnapshotList.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *SnapshotsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SnapshotsListByResourceGroupOptions) (*azcore.Request, error) { +func (client *SnapshotsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SnapshotsListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -491,106 +400,77 @@ func (client *SnapshotsClient) listByResourceGroupCreateRequest(ctx context.Cont return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *SnapshotsClient) listByResourceGroupHandleResponse(resp *azcore.Response) (SnapshotListResponse, error) { - var val *SnapshotList - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SnapshotListResponse{}, err +func (client *SnapshotsClient) listByResourceGroupHandleResponse(resp *http.Response) (SnapshotsListByResourceGroupResponse, error) { + result := SnapshotsListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotList); err != nil { + return SnapshotsListByResourceGroupResponse{}, err } - return SnapshotListResponse{RawResponse: resp.Response, SnapshotList: val}, nil + return result, nil } // listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *SnapshotsClient) listByResourceGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SnapshotsClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginRevokeAccess - Revokes access to a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) BeginRevokeAccess(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginRevokeAccessOptions) (HTTPPollerResponse, error) { +func (client *SnapshotsClient) BeginRevokeAccess(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginRevokeAccessOptions) (SnapshotsRevokeAccessPollerResponse, error) { resp, err := client.revokeAccess(ctx, resourceGroupName, snapshotName, options) if err != nil { - return HTTPPollerResponse{}, err + return SnapshotsRevokeAccessPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := SnapshotsRevokeAccessPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("SnapshotsClient.RevokeAccess", "location", resp, client.con.Pipeline(), client.revokeAccessHandleError) + pt, err := armruntime.NewPoller("SnapshotsClient.RevokeAccess", "location", resp, client.pl, client.revokeAccessHandleError) if err != nil { - return HTTPPollerResponse{}, err + return SnapshotsRevokeAccessPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &SnapshotsRevokeAccessPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeRevokeAccess creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *SnapshotsClient) ResumeRevokeAccess(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("SnapshotsClient.RevokeAccess", token, client.con.Pipeline(), client.revokeAccessHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // RevokeAccess - Revokes access to a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) revokeAccess(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginRevokeAccessOptions) (*azcore.Response, error) { +func (client *SnapshotsClient) revokeAccess(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginRevokeAccessOptions) (*http.Response, error) { req, err := client.revokeAccessCreateRequest(ctx, resourceGroupName, snapshotName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.revokeAccessHandleError(resp) } return resp, nil } // revokeAccessCreateRequest creates the RevokeAccess request. -func (client *SnapshotsClient) revokeAccessCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginRevokeAccessOptions) (*azcore.Request, error) { +func (client *SnapshotsClient) revokeAccessCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, options *SnapshotsBeginRevokeAccessOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}/endGetAccess" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -604,96 +484,67 @@ func (client *SnapshotsClient) revokeAccessCreateRequest(ctx context.Context, re return nil, errors.New("parameter snapshotName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // revokeAccessHandleError handles the RevokeAccess error response. -func (client *SnapshotsClient) revokeAccessHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SnapshotsClient) revokeAccessHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginUpdate - Updates (patches) a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) BeginUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsBeginUpdateOptions) (SnapshotPollerResponse, error) { +func (client *SnapshotsClient) BeginUpdate(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsBeginUpdateOptions) (SnapshotsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, snapshotName, snapshot, options) if err != nil { - return SnapshotPollerResponse{}, err - } - result := SnapshotPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("SnapshotsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return SnapshotPollerResponse{}, err - } - poller := &snapshotPoller{ - pt: pt, + return SnapshotsUpdatePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (SnapshotResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := SnapshotsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new SnapshotPoller from the specified resume token. -// token - The value must come from a previous call to SnapshotPoller.ResumeToken(). -func (client *SnapshotsClient) ResumeUpdate(ctx context.Context, token string) (SnapshotPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("SnapshotsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("SnapshotsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return SnapshotPollerResponse{}, err + return SnapshotsUpdatePollerResponse{}, err } - poller := &snapshotPoller{ + result.Poller = &SnapshotsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return SnapshotPollerResponse{}, err - } - result := SnapshotPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (SnapshotResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Updates (patches) a snapshot. // If the operation fails it returns a generic error. -func (client *SnapshotsClient) update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsBeginUpdateOptions) (*azcore.Response, error) { +func (client *SnapshotsClient) update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, snapshotName, snapshot, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *SnapshotsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsBeginUpdateOptions) (*azcore.Request, error) { +func (client *SnapshotsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/snapshots/{snapshotName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -707,26 +558,25 @@ func (client *SnapshotsClient) updateCreateRequest(ctx context.Context, resource return nil, errors.New("parameter snapshotName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{snapshotName}", url.PathEscape(snapshotName)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-12-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(snapshot) + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, snapshot) } // updateHandleError handles the Update error response. -func (client *SnapshotsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SnapshotsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_sshpublickeys_client.go b/sdk/compute/armcompute/zz_generated_sshpublickeys_client.go index 27e27480de05..7e96de3eefac 100644 --- a/sdk/compute/armcompute/zz_generated_sshpublickeys_client.go +++ b/sdk/compute/armcompute/zz_generated_sshpublickeys_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,44 +11,47 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // SSHPublicKeysClient contains the methods for the SSHPublicKeys group. // Don't use this type directly, use NewSSHPublicKeysClient() instead. type SSHPublicKeysClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewSSHPublicKeysClient creates a new instance of SSHPublicKeysClient with the specified values. -func NewSSHPublicKeysClient(con *armcore.Connection, subscriptionID string) *SSHPublicKeysClient { - return &SSHPublicKeysClient{con: con, subscriptionID: subscriptionID} +func NewSSHPublicKeysClient(con *arm.Connection, subscriptionID string) *SSHPublicKeysClient { + return &SSHPublicKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // Create - Creates a new SSH public key resource. // If the operation fails it returns a generic error. -func (client *SSHPublicKeysClient) Create(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyResource, options *SSHPublicKeysCreateOptions) (SSHPublicKeyResourceResponse, error) { +func (client *SSHPublicKeysClient) Create(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyResource, options *SSHPublicKeysCreateOptions) (SSHPublicKeysCreateResponse, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, sshPublicKeyName, parameters, options) if err != nil { - return SSHPublicKeyResourceResponse{}, err + return SSHPublicKeysCreateResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return SSHPublicKeyResourceResponse{}, err + return SSHPublicKeysCreateResponse{}, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { - return SSHPublicKeyResourceResponse{}, client.createHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return SSHPublicKeysCreateResponse{}, client.createHandleError(resp) } return client.createHandleResponse(resp) } // createCreateRequest creates the Create request. -func (client *SSHPublicKeysClient) createCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyResource, options *SSHPublicKeysCreateOptions) (*azcore.Request, error) { +func (client *SSHPublicKeysClient) createCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyResource, options *SSHPublicKeysCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -61,58 +65,57 @@ func (client *SSHPublicKeysClient) createCreateRequest(ctx context.Context, reso return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // createHandleResponse handles the Create response. -func (client *SSHPublicKeysClient) createHandleResponse(resp *azcore.Response) (SSHPublicKeyResourceResponse, error) { - var val *SSHPublicKeyResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SSHPublicKeyResourceResponse{}, err +func (client *SSHPublicKeysClient) createHandleResponse(resp *http.Response) (SSHPublicKeysCreateResponse, error) { + result := SSHPublicKeysCreateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyResource); err != nil { + return SSHPublicKeysCreateResponse{}, err } - return SSHPublicKeyResourceResponse{RawResponse: resp.Response, SSHPublicKeyResource: val}, nil + return result, nil } // createHandleError handles the Create error response. -func (client *SSHPublicKeysClient) createHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SSHPublicKeysClient) createHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Delete - Delete an SSH public key. // If the operation fails it returns a generic error. -func (client *SSHPublicKeysClient) Delete(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysDeleteOptions) (*http.Response, error) { +func (client *SSHPublicKeysClient) Delete(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysDeleteOptions) (SSHPublicKeysDeleteResponse, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, sshPublicKeyName, options) if err != nil { - return nil, err + return SSHPublicKeysDeleteResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return nil, err + return SSHPublicKeysDeleteResponse{}, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusNoContent) { - return nil, client.deleteHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SSHPublicKeysDeleteResponse{}, client.deleteHandleError(resp) } - return resp.Response, nil + return SSHPublicKeysDeleteResponse{RawResponse: resp}, nil } // deleteCreateRequest creates the Delete request. -func (client *SSHPublicKeysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysDeleteOptions) (*azcore.Request, error) { +func (client *SSHPublicKeysClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -126,50 +129,49 @@ func (client *SSHPublicKeysClient) deleteCreateRequest(ctx context.Context, reso return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *SSHPublicKeysClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SSHPublicKeysClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // GenerateKeyPair - Generates and returns a public/private key pair and populates the SSH public key resource with the public key. The length of the key // will be 3072 bits. This operation can only be performed once per // SSH public key resource. // If the operation fails it returns a generic error. -func (client *SSHPublicKeysClient) GenerateKeyPair(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysGenerateKeyPairOptions) (SSHPublicKeyGenerateKeyPairResultResponse, error) { +func (client *SSHPublicKeysClient) GenerateKeyPair(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysGenerateKeyPairOptions) (SSHPublicKeysGenerateKeyPairResponse, error) { req, err := client.generateKeyPairCreateRequest(ctx, resourceGroupName, sshPublicKeyName, options) if err != nil { - return SSHPublicKeyGenerateKeyPairResultResponse{}, err + return SSHPublicKeysGenerateKeyPairResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return SSHPublicKeyGenerateKeyPairResultResponse{}, err + return SSHPublicKeysGenerateKeyPairResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return SSHPublicKeyGenerateKeyPairResultResponse{}, client.generateKeyPairHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SSHPublicKeysGenerateKeyPairResponse{}, client.generateKeyPairHandleError(resp) } return client.generateKeyPairHandleResponse(resp) } // generateKeyPairCreateRequest creates the GenerateKeyPair request. -func (client *SSHPublicKeysClient) generateKeyPairCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysGenerateKeyPairOptions) (*azcore.Request, error) { +func (client *SSHPublicKeysClient) generateKeyPairCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysGenerateKeyPairOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -183,58 +185,57 @@ func (client *SSHPublicKeysClient) generateKeyPairCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // generateKeyPairHandleResponse handles the GenerateKeyPair response. -func (client *SSHPublicKeysClient) generateKeyPairHandleResponse(resp *azcore.Response) (SSHPublicKeyGenerateKeyPairResultResponse, error) { - var val *SSHPublicKeyGenerateKeyPairResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SSHPublicKeyGenerateKeyPairResultResponse{}, err +func (client *SSHPublicKeysClient) generateKeyPairHandleResponse(resp *http.Response) (SSHPublicKeysGenerateKeyPairResponse, error) { + result := SSHPublicKeysGenerateKeyPairResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyGenerateKeyPairResult); err != nil { + return SSHPublicKeysGenerateKeyPairResponse{}, err } - return SSHPublicKeyGenerateKeyPairResultResponse{RawResponse: resp.Response, SSHPublicKeyGenerateKeyPairResult: val}, nil + return result, nil } // generateKeyPairHandleError handles the GenerateKeyPair error response. -func (client *SSHPublicKeysClient) generateKeyPairHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SSHPublicKeysClient) generateKeyPairHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Retrieves information about an SSH public key. // If the operation fails it returns a generic error. -func (client *SSHPublicKeysClient) Get(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysGetOptions) (SSHPublicKeyResourceResponse, error) { +func (client *SSHPublicKeysClient) Get(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysGetOptions) (SSHPublicKeysGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, sshPublicKeyName, options) if err != nil { - return SSHPublicKeyResourceResponse{}, err + return SSHPublicKeysGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return SSHPublicKeyResourceResponse{}, err + return SSHPublicKeysGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return SSHPublicKeyResourceResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SSHPublicKeysGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *SSHPublicKeysClient) getCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysGetOptions) (*azcore.Request, error) { +func (client *SSHPublicKeysClient) getCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, options *SSHPublicKeysGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -248,59 +249,55 @@ func (client *SSHPublicKeysClient) getCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *SSHPublicKeysClient) getHandleResponse(resp *azcore.Response) (SSHPublicKeyResourceResponse, error) { - var val *SSHPublicKeyResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SSHPublicKeyResourceResponse{}, err +func (client *SSHPublicKeysClient) getHandleResponse(resp *http.Response) (SSHPublicKeysGetResponse, error) { + result := SSHPublicKeysGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyResource); err != nil { + return SSHPublicKeysGetResponse{}, err } - return SSHPublicKeyResourceResponse{RawResponse: resp.Response, SSHPublicKeyResource: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *SSHPublicKeysClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SSHPublicKeysClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListByResourceGroup - 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. // If the operation fails it returns a generic error. -func (client *SSHPublicKeysClient) ListByResourceGroup(resourceGroupName string, options *SSHPublicKeysListByResourceGroupOptions) SSHPublicKeysGroupListResultPager { - return &sshPublicKeysGroupListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *SSHPublicKeysClient) ListByResourceGroup(resourceGroupName string, options *SSHPublicKeysListByResourceGroupOptions) *SSHPublicKeysListByResourceGroupPager { + return &SSHPublicKeysListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listByResourceGroupHandleResponse, - errorer: client.listByResourceGroupHandleError, - advancer: func(ctx context.Context, resp SSHPublicKeysGroupListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.SSHPublicKeysGroupListResult.NextLink) + advancer: func(ctx context.Context, resp SSHPublicKeysListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SSHPublicKeysGroupListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *SSHPublicKeysClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SSHPublicKeysListByResourceGroupOptions) (*azcore.Request, error) { +func (client *SSHPublicKeysClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SSHPublicKeysListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -310,116 +307,111 @@ func (client *SSHPublicKeysClient) listByResourceGroupCreateRequest(ctx context. return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *SSHPublicKeysClient) listByResourceGroupHandleResponse(resp *azcore.Response) (SSHPublicKeysGroupListResultResponse, error) { - var val *SSHPublicKeysGroupListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SSHPublicKeysGroupListResultResponse{}, err +func (client *SSHPublicKeysClient) listByResourceGroupHandleResponse(resp *http.Response) (SSHPublicKeysListByResourceGroupResponse, error) { + result := SSHPublicKeysListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeysGroupListResult); err != nil { + return SSHPublicKeysListByResourceGroupResponse{}, err } - return SSHPublicKeysGroupListResultResponse{RawResponse: resp.Response, SSHPublicKeysGroupListResult: val}, nil + return result, nil } // listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *SSHPublicKeysClient) listByResourceGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SSHPublicKeysClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListBySubscription - 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. // If the operation fails it returns a generic error. -func (client *SSHPublicKeysClient) ListBySubscription(options *SSHPublicKeysListBySubscriptionOptions) SSHPublicKeysGroupListResultPager { - return &sshPublicKeysGroupListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *SSHPublicKeysClient) ListBySubscription(options *SSHPublicKeysListBySubscriptionOptions) *SSHPublicKeysListBySubscriptionPager { + return &SSHPublicKeysListBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listBySubscriptionCreateRequest(ctx, options) }, - responder: client.listBySubscriptionHandleResponse, - errorer: client.listBySubscriptionHandleError, - advancer: func(ctx context.Context, resp SSHPublicKeysGroupListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.SSHPublicKeysGroupListResult.NextLink) + advancer: func(ctx context.Context, resp SSHPublicKeysListBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SSHPublicKeysGroupListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *SSHPublicKeysClient) listBySubscriptionCreateRequest(ctx context.Context, options *SSHPublicKeysListBySubscriptionOptions) (*azcore.Request, error) { +func (client *SSHPublicKeysClient) listBySubscriptionCreateRequest(ctx context.Context, options *SSHPublicKeysListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *SSHPublicKeysClient) listBySubscriptionHandleResponse(resp *azcore.Response) (SSHPublicKeysGroupListResultResponse, error) { - var val *SSHPublicKeysGroupListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SSHPublicKeysGroupListResultResponse{}, err +func (client *SSHPublicKeysClient) listBySubscriptionHandleResponse(resp *http.Response) (SSHPublicKeysListBySubscriptionResponse, error) { + result := SSHPublicKeysListBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeysGroupListResult); err != nil { + return SSHPublicKeysListBySubscriptionResponse{}, err } - return SSHPublicKeysGroupListResultResponse{RawResponse: resp.Response, SSHPublicKeysGroupListResult: val}, nil + return result, nil } // listBySubscriptionHandleError handles the ListBySubscription error response. -func (client *SSHPublicKeysClient) listBySubscriptionHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SSHPublicKeysClient) listBySubscriptionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Update - Updates a new SSH public key resource. // If the operation fails it returns a generic error. -func (client *SSHPublicKeysClient) Update(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyUpdateResource, options *SSHPublicKeysUpdateOptions) (SSHPublicKeyResourceResponse, error) { +func (client *SSHPublicKeysClient) Update(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyUpdateResource, options *SSHPublicKeysUpdateOptions) (SSHPublicKeysUpdateResponse, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, sshPublicKeyName, parameters, options) if err != nil { - return SSHPublicKeyResourceResponse{}, err + return SSHPublicKeysUpdateResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return SSHPublicKeyResourceResponse{}, err + return SSHPublicKeysUpdateResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return SSHPublicKeyResourceResponse{}, client.updateHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SSHPublicKeysUpdateResponse{}, client.updateHandleError(resp) } return client.updateHandleResponse(resp) } // updateCreateRequest creates the Update request. -func (client *SSHPublicKeysClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyUpdateResource, options *SSHPublicKeysUpdateOptions) (*azcore.Request, error) { +func (client *SSHPublicKeysClient) updateCreateRequest(ctx context.Context, resourceGroupName string, sshPublicKeyName string, parameters SSHPublicKeyUpdateResource, options *SSHPublicKeysUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -433,35 +425,34 @@ func (client *SSHPublicKeysClient) updateCreateRequest(ctx context.Context, reso return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // updateHandleResponse handles the Update response. -func (client *SSHPublicKeysClient) updateHandleResponse(resp *azcore.Response) (SSHPublicKeyResourceResponse, error) { - var val *SSHPublicKeyResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return SSHPublicKeyResourceResponse{}, err +func (client *SSHPublicKeysClient) updateHandleResponse(resp *http.Response) (SSHPublicKeysUpdateResponse, error) { + result := SSHPublicKeysUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyResource); err != nil { + return SSHPublicKeysUpdateResponse{}, err } - return SSHPublicKeyResourceResponse{RawResponse: resp.Response, SSHPublicKeyResource: val}, nil + return result, nil } // updateHandleError handles the Update error response. -func (client *SSHPublicKeysClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *SSHPublicKeysClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_time_rfc3339.go b/sdk/compute/armcompute/zz_generated_time_rfc3339.go index fd5eed8400df..07a2d81ca612 100644 --- a/sdk/compute/armcompute/zz_generated_time_rfc3339.go +++ b/sdk/compute/armcompute/zz_generated_time_rfc3339.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. diff --git a/sdk/compute/armcompute/zz_generated_usage_client.go b/sdk/compute/armcompute/zz_generated_usage_client.go index e298cebfd47e..62f7c4199e3e 100644 --- a/sdk/compute/armcompute/zz_generated_usage_client.go +++ b/sdk/compute/armcompute/zz_generated_usage_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,44 +11,44 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // UsageClient contains the methods for the Usage group. // Don't use this type directly, use NewUsageClient() instead. type UsageClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewUsageClient creates a new instance of UsageClient with the specified values. -func NewUsageClient(con *armcore.Connection, subscriptionID string) *UsageClient { - return &UsageClient{con: con, subscriptionID: subscriptionID} +func NewUsageClient(con *arm.Connection, subscriptionID string) *UsageClient { + return &UsageClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // List - Gets, for the specified location, the current compute resource usage information as well as the limits for compute resources under the subscription. // If the operation fails it returns a generic error. -func (client *UsageClient) List(location string, options *UsageListOptions) ListUsagesResultPager { - return &listUsagesResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *UsageClient) List(location string, options *UsageListOptions) *UsageListPager { + return &UsageListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, location, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp ListUsagesResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.ListUsagesResult.NextLink) + advancer: func(ctx context.Context, resp UsageListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ListUsagesResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *UsageClient) listCreateRequest(ctx context.Context, location string, options *UsageListOptions) (*azcore.Request, error) { +func (client *UsageClient) listCreateRequest(ctx context.Context, location string, options *UsageListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -57,35 +58,34 @@ func (client *UsageClient) listCreateRequest(ctx context.Context, location strin return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *UsageClient) listHandleResponse(resp *azcore.Response) (ListUsagesResultResponse, error) { - var val *ListUsagesResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return ListUsagesResultResponse{}, err +func (client *UsageClient) listHandleResponse(resp *http.Response) (UsageListResponse, error) { + result := UsageListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ListUsagesResult); err != nil { + return UsageListResponse{}, err } - return ListUsagesResultResponse{RawResponse: resp.Response, ListUsagesResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *UsageClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *UsageClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachineextensionimages_client.go b/sdk/compute/armcompute/zz_generated_virtualmachineextensionimages_client.go index 57051fc875ae..a14c59e23f2f 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachineextensionimages_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachineextensionimages_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,45 +11,48 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strconv" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineExtensionImagesClient contains the methods for the VirtualMachineExtensionImages group. // Don't use this type directly, use NewVirtualMachineExtensionImagesClient() instead. type VirtualMachineExtensionImagesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineExtensionImagesClient creates a new instance of VirtualMachineExtensionImagesClient with the specified values. -func NewVirtualMachineExtensionImagesClient(con *armcore.Connection, subscriptionID string) *VirtualMachineExtensionImagesClient { - return &VirtualMachineExtensionImagesClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineExtensionImagesClient(con *arm.Connection, subscriptionID string) *VirtualMachineExtensionImagesClient { + return &VirtualMachineExtensionImagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // Get - Gets a virtual machine extension image. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionImagesClient) Get(ctx context.Context, location string, publisherName string, typeParam string, version string, options *VirtualMachineExtensionImagesGetOptions) (VirtualMachineExtensionImageResponse, error) { +func (client *VirtualMachineExtensionImagesClient) Get(ctx context.Context, location string, publisherName string, typeParam string, version string, options *VirtualMachineExtensionImagesGetOptions) (VirtualMachineExtensionImagesGetResponse, error) { req, err := client.getCreateRequest(ctx, location, publisherName, typeParam, version, options) if err != nil { - return VirtualMachineExtensionImageResponse{}, err + return VirtualMachineExtensionImagesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineExtensionImageResponse{}, err + return VirtualMachineExtensionImagesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineExtensionImageResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineExtensionImagesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachineExtensionImagesClient) getCreateRequest(ctx context.Context, location string, publisherName string, typeParam string, version string, options *VirtualMachineExtensionImagesGetOptions) (*azcore.Request, error) { +func (client *VirtualMachineExtensionImagesClient) getCreateRequest(ctx context.Context, location string, publisherName string, typeParam string, version string, options *VirtualMachineExtensionImagesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -70,58 +74,57 @@ func (client *VirtualMachineExtensionImagesClient) getCreateRequest(ctx context. return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachineExtensionImagesClient) getHandleResponse(resp *azcore.Response) (VirtualMachineExtensionImageResponse, error) { - var val *VirtualMachineExtensionImage - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineExtensionImageResponse{}, err +func (client *VirtualMachineExtensionImagesClient) getHandleResponse(resp *http.Response) (VirtualMachineExtensionImagesGetResponse, error) { + result := VirtualMachineExtensionImagesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionImage); err != nil { + return VirtualMachineExtensionImagesGetResponse{}, err } - return VirtualMachineExtensionImageResponse{RawResponse: resp.Response, VirtualMachineExtensionImage: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachineExtensionImagesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineExtensionImagesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListTypes - Gets a list of virtual machine extension image types. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionImagesClient) ListTypes(ctx context.Context, location string, publisherName string, options *VirtualMachineExtensionImagesListTypesOptions) (VirtualMachineExtensionImageArrayResponse, error) { +func (client *VirtualMachineExtensionImagesClient) ListTypes(ctx context.Context, location string, publisherName string, options *VirtualMachineExtensionImagesListTypesOptions) (VirtualMachineExtensionImagesListTypesResponse, error) { req, err := client.listTypesCreateRequest(ctx, location, publisherName, options) if err != nil { - return VirtualMachineExtensionImageArrayResponse{}, err + return VirtualMachineExtensionImagesListTypesResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineExtensionImageArrayResponse{}, err + return VirtualMachineExtensionImagesListTypesResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineExtensionImageArrayResponse{}, client.listTypesHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineExtensionImagesListTypesResponse{}, client.listTypesHandleError(resp) } return client.listTypesHandleResponse(resp) } // listTypesCreateRequest creates the ListTypes request. -func (client *VirtualMachineExtensionImagesClient) listTypesCreateRequest(ctx context.Context, location string, publisherName string, options *VirtualMachineExtensionImagesListTypesOptions) (*azcore.Request, error) { +func (client *VirtualMachineExtensionImagesClient) listTypesCreateRequest(ctx context.Context, location string, publisherName string, options *VirtualMachineExtensionImagesListTypesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -135,58 +138,57 @@ func (client *VirtualMachineExtensionImagesClient) listTypesCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listTypesHandleResponse handles the ListTypes response. -func (client *VirtualMachineExtensionImagesClient) listTypesHandleResponse(resp *azcore.Response) (VirtualMachineExtensionImageArrayResponse, error) { - var val []*VirtualMachineExtensionImage - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineExtensionImageArrayResponse{}, err +func (client *VirtualMachineExtensionImagesClient) listTypesHandleResponse(resp *http.Response) (VirtualMachineExtensionImagesListTypesResponse, error) { + result := VirtualMachineExtensionImagesListTypesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionImageArray); err != nil { + return VirtualMachineExtensionImagesListTypesResponse{}, err } - return VirtualMachineExtensionImageArrayResponse{RawResponse: resp.Response, VirtualMachineExtensionImageArray: val}, nil + return result, nil } // listTypesHandleError handles the ListTypes error response. -func (client *VirtualMachineExtensionImagesClient) listTypesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineExtensionImagesClient) listTypesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListVersions - Gets a list of virtual machine extension image versions. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionImagesClient) ListVersions(ctx context.Context, location string, publisherName string, typeParam string, options *VirtualMachineExtensionImagesListVersionsOptions) (VirtualMachineExtensionImageArrayResponse, error) { +func (client *VirtualMachineExtensionImagesClient) ListVersions(ctx context.Context, location string, publisherName string, typeParam string, options *VirtualMachineExtensionImagesListVersionsOptions) (VirtualMachineExtensionImagesListVersionsResponse, error) { req, err := client.listVersionsCreateRequest(ctx, location, publisherName, typeParam, options) if err != nil { - return VirtualMachineExtensionImageArrayResponse{}, err + return VirtualMachineExtensionImagesListVersionsResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineExtensionImageArrayResponse{}, err + return VirtualMachineExtensionImagesListVersionsResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineExtensionImageArrayResponse{}, client.listVersionsHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineExtensionImagesListVersionsResponse{}, client.listVersionsHandleError(resp) } return client.listVersionsHandleResponse(resp) } // listVersionsCreateRequest creates the ListVersions request. -func (client *VirtualMachineExtensionImagesClient) listVersionsCreateRequest(ctx context.Context, location string, publisherName string, typeParam string, options *VirtualMachineExtensionImagesListVersionsOptions) (*azcore.Request, error) { +func (client *VirtualMachineExtensionImagesClient) listVersionsCreateRequest(ctx context.Context, location string, publisherName string, typeParam string, options *VirtualMachineExtensionImagesListVersionsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -204,12 +206,11 @@ func (client *VirtualMachineExtensionImagesClient) listVersionsCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -219,29 +220,29 @@ func (client *VirtualMachineExtensionImagesClient) listVersionsCreateRequest(ctx if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listVersionsHandleResponse handles the ListVersions response. -func (client *VirtualMachineExtensionImagesClient) listVersionsHandleResponse(resp *azcore.Response) (VirtualMachineExtensionImageArrayResponse, error) { - var val []*VirtualMachineExtensionImage - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineExtensionImageArrayResponse{}, err +func (client *VirtualMachineExtensionImagesClient) listVersionsHandleResponse(resp *http.Response) (VirtualMachineExtensionImagesListVersionsResponse, error) { + result := VirtualMachineExtensionImagesListVersionsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionImageArray); err != nil { + return VirtualMachineExtensionImagesListVersionsResponse{}, err } - return VirtualMachineExtensionImageArrayResponse{RawResponse: resp.Response, VirtualMachineExtensionImageArray: val}, nil + return result, nil } // listVersionsHandleError handles the ListVersions error response. -func (client *VirtualMachineExtensionImagesClient) listVersionsHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineExtensionImagesClient) listVersionsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachineextensions_client.go b/sdk/compute/armcompute/zz_generated_virtualmachineextensions_client.go index 46f71e5c4de8..68d258920f08 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachineextensions_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachineextensions_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,93 +11,68 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineExtensionsClient contains the methods for the VirtualMachineExtensions group. // Don't use this type directly, use NewVirtualMachineExtensionsClient() instead. type VirtualMachineExtensionsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineExtensionsClient creates a new instance of VirtualMachineExtensionsClient with the specified values. -func NewVirtualMachineExtensionsClient(con *armcore.Connection, subscriptionID string) *VirtualMachineExtensionsClient { - return &VirtualMachineExtensionsClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineExtensionsClient(con *arm.Connection, subscriptionID string) *VirtualMachineExtensionsClient { + return &VirtualMachineExtensionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsBeginCreateOrUpdateOptions) (VirtualMachineExtensionPollerResponse, error) { +func (client *VirtualMachineExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsBeginCreateOrUpdateOptions) (VirtualMachineExtensionsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) if err != nil { - return VirtualMachineExtensionPollerResponse{}, err + return VirtualMachineExtensionsCreateOrUpdatePollerResponse{}, err } - result := VirtualMachineExtensionPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineExtensionsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineExtensionsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineExtensionsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return VirtualMachineExtensionPollerResponse{}, err + return VirtualMachineExtensionsCreateOrUpdatePollerResponse{}, err } - poller := &virtualMachineExtensionPoller{ + result.Poller = &VirtualMachineExtensionsCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new VirtualMachineExtensionPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineExtensionPoller.ResumeToken(). -func (client *VirtualMachineExtensionsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (VirtualMachineExtensionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineExtensionsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return VirtualMachineExtensionPollerResponse{}, err - } - poller := &virtualMachineExtensionPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineExtensionPollerResponse{}, err - } - result := VirtualMachineExtensionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - The operation to create or update the extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualMachineExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, options *VirtualMachineExtensionsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -114,97 +90,68 @@ func (client *VirtualMachineExtensionsClient) createOrUpdateCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(extensionParameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, extensionParameters) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *VirtualMachineExtensionsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineExtensionsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDelete - The operation to delete the extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsBeginDeleteOptions) (VirtualMachineExtensionsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, vmName, vmExtensionName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineExtensionsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineExtensionsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineExtensionsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("VirtualMachineExtensionsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineExtensionsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineExtensionsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineExtensionsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineExtensionsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - The operation to delete the extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsBeginDeleteOptions) (*azcore.Response, error) { +func (client *VirtualMachineExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *VirtualMachineExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsBeginDeleteOptions) (*azcore.Request, error) { +func (client *VirtualMachineExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -222,48 +169,47 @@ func (client *VirtualMachineExtensionsClient) deleteCreateRequest(ctx context.Co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *VirtualMachineExtensionsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineExtensionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - The operation to get the extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsGetOptions) (VirtualMachineExtensionResponse, error) { +func (client *VirtualMachineExtensionsClient) Get(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsGetOptions) (VirtualMachineExtensionsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, options) if err != nil { - return VirtualMachineExtensionResponse{}, err + return VirtualMachineExtensionsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineExtensionResponse{}, err + return VirtualMachineExtensionsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineExtensionResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineExtensionsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachineExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsGetOptions) (*azcore.Request, error) { +func (client *VirtualMachineExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, options *VirtualMachineExtensionsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -281,61 +227,60 @@ func (client *VirtualMachineExtensionsClient) getCreateRequest(ctx context.Conte return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachineExtensionsClient) getHandleResponse(resp *azcore.Response) (VirtualMachineExtensionResponse, error) { - var val *VirtualMachineExtension - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineExtensionResponse{}, err +func (client *VirtualMachineExtensionsClient) getHandleResponse(resp *http.Response) (VirtualMachineExtensionsGetResponse, error) { + result := VirtualMachineExtensionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtension); err != nil { + return VirtualMachineExtensionsGetResponse{}, err } - return VirtualMachineExtensionResponse{RawResponse: resp.Response, VirtualMachineExtension: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachineExtensionsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineExtensionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - The operation to get all extensions of a Virtual Machine. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionsClient) List(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachineExtensionsListOptions) (VirtualMachineExtensionsListResultResponse, error) { +func (client *VirtualMachineExtensionsClient) List(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachineExtensionsListOptions) (VirtualMachineExtensionsListResponse, error) { req, err := client.listCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { - return VirtualMachineExtensionsListResultResponse{}, err + return VirtualMachineExtensionsListResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineExtensionsListResultResponse{}, err + return VirtualMachineExtensionsListResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineExtensionsListResultResponse{}, client.listHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineExtensionsListResponse{}, client.listHandleError(resp) } return client.listHandleResponse(resp) } // listCreateRequest creates the List request. -func (client *VirtualMachineExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachineExtensionsListOptions) (*azcore.Request, error) { +func (client *VirtualMachineExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachineExtensionsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -349,109 +294,80 @@ func (client *VirtualMachineExtensionsClient) listCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachineExtensionsClient) listHandleResponse(resp *azcore.Response) (VirtualMachineExtensionsListResultResponse, error) { - var val *VirtualMachineExtensionsListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineExtensionsListResultResponse{}, err +func (client *VirtualMachineExtensionsClient) listHandleResponse(resp *http.Response) (VirtualMachineExtensionsListResponse, error) { + result := VirtualMachineExtensionsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionsListResult); err != nil { + return VirtualMachineExtensionsListResponse{}, err } - return VirtualMachineExtensionsListResultResponse{RawResponse: resp.Response, VirtualMachineExtensionsListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachineExtensionsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineExtensionsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginUpdate - The operation to update the extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsBeginUpdateOptions) (VirtualMachineExtensionPollerResponse, error) { +func (client *VirtualMachineExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsBeginUpdateOptions) (VirtualMachineExtensionsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) if err != nil { - return VirtualMachineExtensionPollerResponse{}, err - } - result := VirtualMachineExtensionPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineExtensionsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return VirtualMachineExtensionPollerResponse{}, err + return VirtualMachineExtensionsUpdatePollerResponse{}, err } - poller := &virtualMachineExtensionPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineExtensionsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new VirtualMachineExtensionPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineExtensionPoller.ResumeToken(). -func (client *VirtualMachineExtensionsClient) ResumeUpdate(ctx context.Context, token string) (VirtualMachineExtensionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineExtensionsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineExtensionsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return VirtualMachineExtensionPollerResponse{}, err + return VirtualMachineExtensionsUpdatePollerResponse{}, err } - poller := &virtualMachineExtensionPoller{ + result.Poller = &VirtualMachineExtensionsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineExtensionPollerResponse{}, err - } - result := VirtualMachineExtensionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - The operation to update the extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineExtensionsClient) update(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsBeginUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineExtensionsClient) update(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, vmExtensionName, extensionParameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *VirtualMachineExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsBeginUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtensionUpdate, options *VirtualMachineExtensionsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -469,26 +385,25 @@ func (client *VirtualMachineExtensionsClient) updateCreateRequest(ctx context.Co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(extensionParameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, extensionParameters) } // updateHandleError handles the Update error response. -func (client *VirtualMachineExtensionsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineExtensionsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachineimages_client.go b/sdk/compute/armcompute/zz_generated_virtualmachineimages_client.go index 1ec567e610d0..adc40788c495 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachineimages_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachineimages_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,45 +11,48 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strconv" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineImagesClient contains the methods for the VirtualMachineImages group. // Don't use this type directly, use NewVirtualMachineImagesClient() instead. type VirtualMachineImagesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineImagesClient creates a new instance of VirtualMachineImagesClient with the specified values. -func NewVirtualMachineImagesClient(con *armcore.Connection, subscriptionID string) *VirtualMachineImagesClient { - return &VirtualMachineImagesClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineImagesClient(con *arm.Connection, subscriptionID string) *VirtualMachineImagesClient { + return &VirtualMachineImagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // Get - Gets a virtual machine image. // If the operation fails it returns a generic error. -func (client *VirtualMachineImagesClient) Get(ctx context.Context, location string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesGetOptions) (VirtualMachineImageResponse, error) { +func (client *VirtualMachineImagesClient) Get(ctx context.Context, location string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesGetOptions) (VirtualMachineImagesGetResponse, error) { req, err := client.getCreateRequest(ctx, location, publisherName, offer, skus, version, options) if err != nil { - return VirtualMachineImageResponse{}, err + return VirtualMachineImagesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineImageResponse{}, err + return VirtualMachineImagesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineImageResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachineImagesClient) getCreateRequest(ctx context.Context, location string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesGetOptions) (*azcore.Request, error) { +func (client *VirtualMachineImagesClient) getCreateRequest(ctx context.Context, location string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -74,58 +78,57 @@ func (client *VirtualMachineImagesClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachineImagesClient) getHandleResponse(resp *azcore.Response) (VirtualMachineImageResponse, error) { - var val *VirtualMachineImage - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineImageResponse{}, err +func (client *VirtualMachineImagesClient) getHandleResponse(resp *http.Response) (VirtualMachineImagesGetResponse, error) { + result := VirtualMachineImagesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImage); err != nil { + return VirtualMachineImagesGetResponse{}, err } - return VirtualMachineImageResponse{RawResponse: resp.Response, VirtualMachineImage: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachineImagesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineImagesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - Gets a list of all virtual machine image versions for the specified location, publisher, offer, and SKU. // If the operation fails it returns a generic error. -func (client *VirtualMachineImagesClient) List(ctx context.Context, location string, publisherName string, offer string, skus string, options *VirtualMachineImagesListOptions) (VirtualMachineImageResourceArrayResponse, error) { +func (client *VirtualMachineImagesClient) List(ctx context.Context, location string, publisherName string, offer string, skus string, options *VirtualMachineImagesListOptions) (VirtualMachineImagesListResponse, error) { req, err := client.listCreateRequest(ctx, location, publisherName, offer, skus, options) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesListResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesListResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineImageResourceArrayResponse{}, client.listHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesListResponse{}, client.listHandleError(resp) } return client.listHandleResponse(resp) } // listCreateRequest creates the List request. -func (client *VirtualMachineImagesClient) listCreateRequest(ctx context.Context, location string, publisherName string, offer string, skus string, options *VirtualMachineImagesListOptions) (*azcore.Request, error) { +func (client *VirtualMachineImagesClient) listCreateRequest(ctx context.Context, location string, publisherName string, offer string, skus string, options *VirtualMachineImagesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -147,12 +150,11 @@ func (client *VirtualMachineImagesClient) listCreateRequest(ctx context.Context, return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -162,52 +164,52 @@ func (client *VirtualMachineImagesClient) listCreateRequest(ctx context.Context, if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachineImagesClient) listHandleResponse(resp *azcore.Response) (VirtualMachineImageResourceArrayResponse, error) { - var val []*VirtualMachineImageResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineImageResourceArrayResponse{}, err +func (client *VirtualMachineImagesClient) listHandleResponse(resp *http.Response) (VirtualMachineImagesListResponse, error) { + result := VirtualMachineImagesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesListResponse{}, err } - return VirtualMachineImageResourceArrayResponse{RawResponse: resp.Response, VirtualMachineImageResourceArray: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachineImagesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineImagesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListOffers - Gets a list of virtual machine image offers for the specified location and publisher. // If the operation fails it returns a generic error. -func (client *VirtualMachineImagesClient) ListOffers(ctx context.Context, location string, publisherName string, options *VirtualMachineImagesListOffersOptions) (VirtualMachineImageResourceArrayResponse, error) { +func (client *VirtualMachineImagesClient) ListOffers(ctx context.Context, location string, publisherName string, options *VirtualMachineImagesListOffersOptions) (VirtualMachineImagesListOffersResponse, error) { req, err := client.listOffersCreateRequest(ctx, location, publisherName, options) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesListOffersResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesListOffersResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineImageResourceArrayResponse{}, client.listOffersHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesListOffersResponse{}, client.listOffersHandleError(resp) } return client.listOffersHandleResponse(resp) } // listOffersCreateRequest creates the ListOffers request. -func (client *VirtualMachineImagesClient) listOffersCreateRequest(ctx context.Context, location string, publisherName string, options *VirtualMachineImagesListOffersOptions) (*azcore.Request, error) { +func (client *VirtualMachineImagesClient) listOffersCreateRequest(ctx context.Context, location string, publisherName string, options *VirtualMachineImagesListOffersOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -221,58 +223,57 @@ func (client *VirtualMachineImagesClient) listOffersCreateRequest(ctx context.Co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listOffersHandleResponse handles the ListOffers response. -func (client *VirtualMachineImagesClient) listOffersHandleResponse(resp *azcore.Response) (VirtualMachineImageResourceArrayResponse, error) { - var val []*VirtualMachineImageResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineImageResourceArrayResponse{}, err +func (client *VirtualMachineImagesClient) listOffersHandleResponse(resp *http.Response) (VirtualMachineImagesListOffersResponse, error) { + result := VirtualMachineImagesListOffersResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesListOffersResponse{}, err } - return VirtualMachineImageResourceArrayResponse{RawResponse: resp.Response, VirtualMachineImageResourceArray: val}, nil + return result, nil } // listOffersHandleError handles the ListOffers error response. -func (client *VirtualMachineImagesClient) listOffersHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineImagesClient) listOffersHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListPublishers - Gets a list of virtual machine image publishers for the specified Azure location. // If the operation fails it returns a generic error. -func (client *VirtualMachineImagesClient) ListPublishers(ctx context.Context, location string, options *VirtualMachineImagesListPublishersOptions) (VirtualMachineImageResourceArrayResponse, error) { +func (client *VirtualMachineImagesClient) ListPublishers(ctx context.Context, location string, options *VirtualMachineImagesListPublishersOptions) (VirtualMachineImagesListPublishersResponse, error) { req, err := client.listPublishersCreateRequest(ctx, location, options) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesListPublishersResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesListPublishersResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineImageResourceArrayResponse{}, client.listPublishersHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesListPublishersResponse{}, client.listPublishersHandleError(resp) } return client.listPublishersHandleResponse(resp) } // listPublishersCreateRequest creates the ListPublishers request. -func (client *VirtualMachineImagesClient) listPublishersCreateRequest(ctx context.Context, location string, options *VirtualMachineImagesListPublishersOptions) (*azcore.Request, error) { +func (client *VirtualMachineImagesClient) listPublishersCreateRequest(ctx context.Context, location string, options *VirtualMachineImagesListPublishersOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -282,58 +283,57 @@ func (client *VirtualMachineImagesClient) listPublishersCreateRequest(ctx contex return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listPublishersHandleResponse handles the ListPublishers response. -func (client *VirtualMachineImagesClient) listPublishersHandleResponse(resp *azcore.Response) (VirtualMachineImageResourceArrayResponse, error) { - var val []*VirtualMachineImageResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineImageResourceArrayResponse{}, err +func (client *VirtualMachineImagesClient) listPublishersHandleResponse(resp *http.Response) (VirtualMachineImagesListPublishersResponse, error) { + result := VirtualMachineImagesListPublishersResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesListPublishersResponse{}, err } - return VirtualMachineImageResourceArrayResponse{RawResponse: resp.Response, VirtualMachineImageResourceArray: val}, nil + return result, nil } // listPublishersHandleError handles the ListPublishers error response. -func (client *VirtualMachineImagesClient) listPublishersHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineImagesClient) listPublishersHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListSKUs - Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. // If the operation fails it returns a generic error. -func (client *VirtualMachineImagesClient) ListSKUs(ctx context.Context, location string, publisherName string, offer string, options *VirtualMachineImagesListSKUsOptions) (VirtualMachineImageResourceArrayResponse, error) { +func (client *VirtualMachineImagesClient) ListSKUs(ctx context.Context, location string, publisherName string, offer string, options *VirtualMachineImagesListSKUsOptions) (VirtualMachineImagesListSKUsResponse, error) { req, err := client.listSKUsCreateRequest(ctx, location, publisherName, offer, options) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesListSKUsResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesListSKUsResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineImageResourceArrayResponse{}, client.listSKUsHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesListSKUsResponse{}, client.listSKUsHandleError(resp) } return client.listSKUsHandleResponse(resp) } // listSKUsCreateRequest creates the ListSKUs request. -func (client *VirtualMachineImagesClient) listSKUsCreateRequest(ctx context.Context, location string, publisherName string, offer string, options *VirtualMachineImagesListSKUsOptions) (*azcore.Request, error) { +func (client *VirtualMachineImagesClient) listSKUsCreateRequest(ctx context.Context, location string, publisherName string, offer string, options *VirtualMachineImagesListSKUsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -351,35 +351,34 @@ func (client *VirtualMachineImagesClient) listSKUsCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listSKUsHandleResponse handles the ListSKUs response. -func (client *VirtualMachineImagesClient) listSKUsHandleResponse(resp *azcore.Response) (VirtualMachineImageResourceArrayResponse, error) { - var val []*VirtualMachineImageResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineImageResourceArrayResponse{}, err +func (client *VirtualMachineImagesClient) listSKUsHandleResponse(resp *http.Response) (VirtualMachineImagesListSKUsResponse, error) { + result := VirtualMachineImagesListSKUsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesListSKUsResponse{}, err } - return VirtualMachineImageResourceArrayResponse{RawResponse: resp.Response, VirtualMachineImageResourceArray: val}, nil + return result, nil } // listSKUsHandleError handles the ListSKUs error response. -func (client *VirtualMachineImagesClient) listSKUsHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineImagesClient) listSKUsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachineimagesedgezone_client.go b/sdk/compute/armcompute/zz_generated_virtualmachineimagesedgezone_client.go index b337113465fe..4d7798ac7bf1 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachineimagesedgezone_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachineimagesedgezone_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,45 +12,48 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strconv" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineImagesEdgeZoneClient contains the methods for the VirtualMachineImagesEdgeZone group. // Don't use this type directly, use NewVirtualMachineImagesEdgeZoneClient() instead. type VirtualMachineImagesEdgeZoneClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineImagesEdgeZoneClient creates a new instance of VirtualMachineImagesEdgeZoneClient with the specified values. -func NewVirtualMachineImagesEdgeZoneClient(con *armcore.Connection, subscriptionID string) *VirtualMachineImagesEdgeZoneClient { - return &VirtualMachineImagesEdgeZoneClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineImagesEdgeZoneClient(con *arm.Connection, subscriptionID string) *VirtualMachineImagesEdgeZoneClient { + return &VirtualMachineImagesEdgeZoneClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // Get - Gets a virtual machine image in an edge zone. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineImagesEdgeZoneClient) Get(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesEdgeZoneGetOptions) (VirtualMachineImageResponse, error) { +func (client *VirtualMachineImagesEdgeZoneClient) Get(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesEdgeZoneGetOptions) (VirtualMachineImagesEdgeZoneGetResponse, error) { req, err := client.getCreateRequest(ctx, location, edgeZone, publisherName, offer, skus, version, options) if err != nil { - return VirtualMachineImageResponse{}, err + return VirtualMachineImagesEdgeZoneGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineImageResponse{}, err + return VirtualMachineImagesEdgeZoneGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineImageResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesEdgeZoneGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachineImagesEdgeZoneClient) getCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesEdgeZoneGetOptions) (*azcore.Request, error) { +func (client *VirtualMachineImagesEdgeZoneClient) getCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, version string, options *VirtualMachineImagesEdgeZoneGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -79,59 +83,58 @@ func (client *VirtualMachineImagesEdgeZoneClient) getCreateRequest(ctx context.C return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachineImagesEdgeZoneClient) getHandleResponse(resp *azcore.Response) (VirtualMachineImageResponse, error) { - var val *VirtualMachineImage - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineImageResponse{}, err +func (client *VirtualMachineImagesEdgeZoneClient) getHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneGetResponse, error) { + result := VirtualMachineImagesEdgeZoneGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImage); err != nil { + return VirtualMachineImagesEdgeZoneGetResponse{}, err } - return VirtualMachineImageResponse{RawResponse: resp.Response, VirtualMachineImage: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachineImagesEdgeZoneClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineImagesEdgeZoneClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // 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 the *CloudError error type. -func (client *VirtualMachineImagesEdgeZoneClient) List(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, options *VirtualMachineImagesEdgeZoneListOptions) (VirtualMachineImageResourceArrayResponse, error) { +func (client *VirtualMachineImagesEdgeZoneClient) List(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, options *VirtualMachineImagesEdgeZoneListOptions) (VirtualMachineImagesEdgeZoneListResponse, error) { req, err := client.listCreateRequest(ctx, location, edgeZone, publisherName, offer, skus, options) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesEdgeZoneListResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesEdgeZoneListResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineImageResourceArrayResponse{}, client.listHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesEdgeZoneListResponse{}, client.listHandleError(resp) } return client.listHandleResponse(resp) } // listCreateRequest creates the List request. -func (client *VirtualMachineImagesEdgeZoneClient) listCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, options *VirtualMachineImagesEdgeZoneListOptions) (*azcore.Request, error) { +func (client *VirtualMachineImagesEdgeZoneClient) listCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, offer string, skus string, options *VirtualMachineImagesEdgeZoneListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -157,12 +160,11 @@ func (client *VirtualMachineImagesEdgeZoneClient) listCreateRequest(ctx context. return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -172,53 +174,53 @@ func (client *VirtualMachineImagesEdgeZoneClient) listCreateRequest(ctx context. if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachineImagesEdgeZoneClient) listHandleResponse(resp *azcore.Response) (VirtualMachineImageResourceArrayResponse, error) { - var val []*VirtualMachineImageResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineImageResourceArrayResponse{}, err +func (client *VirtualMachineImagesEdgeZoneClient) listHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneListResponse, error) { + result := VirtualMachineImagesEdgeZoneListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesEdgeZoneListResponse{}, err } - return VirtualMachineImageResourceArrayResponse{RawResponse: resp.Response, VirtualMachineImageResourceArray: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachineImagesEdgeZoneClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineImagesEdgeZoneClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListOffers - Gets a list of virtual machine image offers for the specified location, edge zone and publisher. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineImagesEdgeZoneClient) ListOffers(ctx context.Context, location string, edgeZone string, publisherName string, options *VirtualMachineImagesEdgeZoneListOffersOptions) (VirtualMachineImageResourceArrayResponse, error) { +func (client *VirtualMachineImagesEdgeZoneClient) ListOffers(ctx context.Context, location string, edgeZone string, publisherName string, options *VirtualMachineImagesEdgeZoneListOffersOptions) (VirtualMachineImagesEdgeZoneListOffersResponse, error) { req, err := client.listOffersCreateRequest(ctx, location, edgeZone, publisherName, options) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesEdgeZoneListOffersResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesEdgeZoneListOffersResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineImageResourceArrayResponse{}, client.listOffersHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesEdgeZoneListOffersResponse{}, client.listOffersHandleError(resp) } return client.listOffersHandleResponse(resp) } // listOffersCreateRequest creates the ListOffers request. -func (client *VirtualMachineImagesEdgeZoneClient) listOffersCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, options *VirtualMachineImagesEdgeZoneListOffersOptions) (*azcore.Request, error) { +func (client *VirtualMachineImagesEdgeZoneClient) listOffersCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, options *VirtualMachineImagesEdgeZoneListOffersOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -236,59 +238,58 @@ func (client *VirtualMachineImagesEdgeZoneClient) listOffersCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listOffersHandleResponse handles the ListOffers response. -func (client *VirtualMachineImagesEdgeZoneClient) listOffersHandleResponse(resp *azcore.Response) (VirtualMachineImageResourceArrayResponse, error) { - var val []*VirtualMachineImageResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineImageResourceArrayResponse{}, err +func (client *VirtualMachineImagesEdgeZoneClient) listOffersHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneListOffersResponse, error) { + result := VirtualMachineImagesEdgeZoneListOffersResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesEdgeZoneListOffersResponse{}, err } - return VirtualMachineImageResourceArrayResponse{RawResponse: resp.Response, VirtualMachineImageResourceArray: val}, nil + return result, nil } // listOffersHandleError handles the ListOffers error response. -func (client *VirtualMachineImagesEdgeZoneClient) listOffersHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineImagesEdgeZoneClient) listOffersHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListPublishers - Gets a list of virtual machine image publishers for the specified Azure location and edge zone. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineImagesEdgeZoneClient) ListPublishers(ctx context.Context, location string, edgeZone string, options *VirtualMachineImagesEdgeZoneListPublishersOptions) (VirtualMachineImageResourceArrayResponse, error) { +func (client *VirtualMachineImagesEdgeZoneClient) ListPublishers(ctx context.Context, location string, edgeZone string, options *VirtualMachineImagesEdgeZoneListPublishersOptions) (VirtualMachineImagesEdgeZoneListPublishersResponse, error) { req, err := client.listPublishersCreateRequest(ctx, location, edgeZone, options) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesEdgeZoneListPublishersResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesEdgeZoneListPublishersResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineImageResourceArrayResponse{}, client.listPublishersHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesEdgeZoneListPublishersResponse{}, client.listPublishersHandleError(resp) } return client.listPublishersHandleResponse(resp) } // listPublishersCreateRequest creates the ListPublishers request. -func (client *VirtualMachineImagesEdgeZoneClient) listPublishersCreateRequest(ctx context.Context, location string, edgeZone string, options *VirtualMachineImagesEdgeZoneListPublishersOptions) (*azcore.Request, error) { +func (client *VirtualMachineImagesEdgeZoneClient) listPublishersCreateRequest(ctx context.Context, location string, edgeZone string, options *VirtualMachineImagesEdgeZoneListPublishersOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -302,59 +303,58 @@ func (client *VirtualMachineImagesEdgeZoneClient) listPublishersCreateRequest(ct return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listPublishersHandleResponse handles the ListPublishers response. -func (client *VirtualMachineImagesEdgeZoneClient) listPublishersHandleResponse(resp *azcore.Response) (VirtualMachineImageResourceArrayResponse, error) { - var val []*VirtualMachineImageResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineImageResourceArrayResponse{}, err +func (client *VirtualMachineImagesEdgeZoneClient) listPublishersHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneListPublishersResponse, error) { + result := VirtualMachineImagesEdgeZoneListPublishersResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesEdgeZoneListPublishersResponse{}, err } - return VirtualMachineImageResourceArrayResponse{RawResponse: resp.Response, VirtualMachineImageResourceArray: val}, nil + return result, nil } // listPublishersHandleError handles the ListPublishers error response. -func (client *VirtualMachineImagesEdgeZoneClient) listPublishersHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineImagesEdgeZoneClient) listPublishersHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListSKUs - Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and offer. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineImagesEdgeZoneClient) ListSKUs(ctx context.Context, location string, edgeZone string, publisherName string, offer string, options *VirtualMachineImagesEdgeZoneListSKUsOptions) (VirtualMachineImageResourceArrayResponse, error) { +func (client *VirtualMachineImagesEdgeZoneClient) ListSKUs(ctx context.Context, location string, edgeZone string, publisherName string, offer string, options *VirtualMachineImagesEdgeZoneListSKUsOptions) (VirtualMachineImagesEdgeZoneListSKUsResponse, error) { req, err := client.listSKUsCreateRequest(ctx, location, edgeZone, publisherName, offer, options) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesEdgeZoneListSKUsResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineImageResourceArrayResponse{}, err + return VirtualMachineImagesEdgeZoneListSKUsResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineImageResourceArrayResponse{}, client.listSKUsHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineImagesEdgeZoneListSKUsResponse{}, client.listSKUsHandleError(resp) } return client.listSKUsHandleResponse(resp) } // listSKUsCreateRequest creates the ListSKUs request. -func (client *VirtualMachineImagesEdgeZoneClient) listSKUsCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, offer string, options *VirtualMachineImagesEdgeZoneListSKUsOptions) (*azcore.Request, error) { +func (client *VirtualMachineImagesEdgeZoneClient) listSKUsCreateRequest(ctx context.Context, location string, edgeZone string, publisherName string, offer string, options *VirtualMachineImagesEdgeZoneListSKUsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -376,36 +376,35 @@ func (client *VirtualMachineImagesEdgeZoneClient) listSKUsCreateRequest(ctx cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listSKUsHandleResponse handles the ListSKUs response. -func (client *VirtualMachineImagesEdgeZoneClient) listSKUsHandleResponse(resp *azcore.Response) (VirtualMachineImageResourceArrayResponse, error) { - var val []*VirtualMachineImageResource - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineImageResourceArrayResponse{}, err +func (client *VirtualMachineImagesEdgeZoneClient) listSKUsHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneListSKUsResponse, error) { + result := VirtualMachineImagesEdgeZoneListSKUsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { + return VirtualMachineImagesEdgeZoneListSKUsResponse{}, err } - return VirtualMachineImageResourceArrayResponse{RawResponse: resp.Response, VirtualMachineImageResourceArray: val}, nil + return result, nil } // listSKUsHandleError handles the ListSKUs error response. -func (client *VirtualMachineImagesEdgeZoneClient) listSKUsHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineImagesEdgeZoneClient) listSKUsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachineruncommands_client.go b/sdk/compute/armcompute/zz_generated_virtualmachineruncommands_client.go index 787dd909c86d..f89264c70820 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachineruncommands_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachineruncommands_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineRunCommandsClient contains the methods for the VirtualMachineRunCommands group. // Don't use this type directly, use NewVirtualMachineRunCommandsClient() instead. type VirtualMachineRunCommandsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineRunCommandsClient creates a new instance of VirtualMachineRunCommandsClient with the specified values. -func NewVirtualMachineRunCommandsClient(con *armcore.Connection, subscriptionID string) *VirtualMachineRunCommandsClient { - return &VirtualMachineRunCommandsClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineRunCommandsClient(con *arm.Connection, subscriptionID string) *VirtualMachineRunCommandsClient { + return &VirtualMachineRunCommandsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - The operation to create or update the run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineRunCommandsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsBeginCreateOrUpdateOptions) (VirtualMachineRunCommandPollerResponse, error) { +func (client *VirtualMachineRunCommandsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsBeginCreateOrUpdateOptions) (VirtualMachineRunCommandsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err - } - result := VirtualMachineRunCommandPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineRunCommandsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err - } - poller := &virtualMachineRunCommandPoller{ - pt: pt, + return VirtualMachineRunCommandsCreateOrUpdatePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineRunCommandResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineRunCommandsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeCreateOrUpdate creates a new VirtualMachineRunCommandPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineRunCommandPoller.ResumeToken(). -func (client *VirtualMachineRunCommandsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (VirtualMachineRunCommandPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineRunCommandsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineRunCommandsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err + return VirtualMachineRunCommandsCreateOrUpdatePollerResponse{}, err } - poller := &virtualMachineRunCommandPoller{ + result.Poller = &VirtualMachineRunCommandsCreateOrUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err - } - result := VirtualMachineRunCommandPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineRunCommandResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - The operation to create or update the run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualMachineRunCommandsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineRunCommandsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineRunCommandsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -115,98 +91,69 @@ func (client *VirtualMachineRunCommandsClient) createOrUpdateCreateRequest(ctx c return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") - return req, req.MarshalAsJSON(runCommand) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") + return req, runtime.MarshalAsJSON(req, runCommand) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *VirtualMachineRunCommandsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineRunCommandsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - The operation to delete the run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineRunCommandsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineRunCommandsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsBeginDeleteOptions) (VirtualMachineRunCommandsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, vmName, runCommandName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineRunCommandsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineRunCommandsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineRunCommandsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("VirtualMachineRunCommandsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineRunCommandsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineRunCommandsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineRunCommandsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineRunCommandsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - The operation to delete the run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsBeginDeleteOptions) (*azcore.Response, error) { +func (client *VirtualMachineRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, runCommandName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *VirtualMachineRunCommandsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsBeginDeleteOptions) (*azcore.Request, error) { +func (client *VirtualMachineRunCommandsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -224,50 +171,49 @@ func (client *VirtualMachineRunCommandsClient) deleteCreateRequest(ctx context.C return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *VirtualMachineRunCommandsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineRunCommandsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - Gets specific run command for a subscription in a location. // If the operation fails it returns a generic error. -func (client *VirtualMachineRunCommandsClient) Get(ctx context.Context, location string, commandID string, options *VirtualMachineRunCommandsGetOptions) (RunCommandDocumentResponse, error) { +func (client *VirtualMachineRunCommandsClient) Get(ctx context.Context, location string, commandID string, options *VirtualMachineRunCommandsGetOptions) (VirtualMachineRunCommandsGetResponse, error) { req, err := client.getCreateRequest(ctx, location, commandID, options) if err != nil { - return RunCommandDocumentResponse{}, err + return VirtualMachineRunCommandsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RunCommandDocumentResponse{}, err + return VirtualMachineRunCommandsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return RunCommandDocumentResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineRunCommandsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachineRunCommandsClient) getCreateRequest(ctx context.Context, location string, commandID string, options *VirtualMachineRunCommandsGetOptions) (*azcore.Request, error) { +func (client *VirtualMachineRunCommandsClient) getCreateRequest(ctx context.Context, location string, commandID string, options *VirtualMachineRunCommandsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -281,58 +227,57 @@ func (client *VirtualMachineRunCommandsClient) getCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachineRunCommandsClient) getHandleResponse(resp *azcore.Response) (RunCommandDocumentResponse, error) { - var val *RunCommandDocument - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RunCommandDocumentResponse{}, err +func (client *VirtualMachineRunCommandsClient) getHandleResponse(resp *http.Response) (VirtualMachineRunCommandsGetResponse, error) { + result := VirtualMachineRunCommandsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RunCommandDocument); err != nil { + return VirtualMachineRunCommandsGetResponse{}, err } - return RunCommandDocumentResponse{RawResponse: resp.Response, RunCommandDocument: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachineRunCommandsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineRunCommandsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // GetByVirtualMachine - The operation to get the run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineRunCommandsClient) GetByVirtualMachine(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsGetByVirtualMachineOptions) (VirtualMachineRunCommandResponse, error) { +func (client *VirtualMachineRunCommandsClient) GetByVirtualMachine(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsGetByVirtualMachineOptions) (VirtualMachineRunCommandsGetByVirtualMachineResponse, error) { req, err := client.getByVirtualMachineCreateRequest(ctx, resourceGroupName, vmName, runCommandName, options) if err != nil { - return VirtualMachineRunCommandResponse{}, err + return VirtualMachineRunCommandsGetByVirtualMachineResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineRunCommandResponse{}, err + return VirtualMachineRunCommandsGetByVirtualMachineResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineRunCommandResponse{}, client.getByVirtualMachineHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineRunCommandsGetByVirtualMachineResponse{}, client.getByVirtualMachineHandleError(resp) } return client.getByVirtualMachineHandleResponse(resp) } // getByVirtualMachineCreateRequest creates the GetByVirtualMachine request. -func (client *VirtualMachineRunCommandsClient) getByVirtualMachineCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsGetByVirtualMachineOptions) (*azcore.Request, error) { +func (client *VirtualMachineRunCommandsClient) getByVirtualMachineCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, options *VirtualMachineRunCommandsGetByVirtualMachineOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -350,62 +295,58 @@ func (client *VirtualMachineRunCommandsClient) getByVirtualMachineCreateRequest( return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") return req, nil } // getByVirtualMachineHandleResponse handles the GetByVirtualMachine response. -func (client *VirtualMachineRunCommandsClient) getByVirtualMachineHandleResponse(resp *azcore.Response) (VirtualMachineRunCommandResponse, error) { - var val *VirtualMachineRunCommand - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineRunCommandResponse{}, err +func (client *VirtualMachineRunCommandsClient) getByVirtualMachineHandleResponse(resp *http.Response) (VirtualMachineRunCommandsGetByVirtualMachineResponse, error) { + result := VirtualMachineRunCommandsGetByVirtualMachineResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommand); err != nil { + return VirtualMachineRunCommandsGetByVirtualMachineResponse{}, err } - return VirtualMachineRunCommandResponse{RawResponse: resp.Response, VirtualMachineRunCommand: val}, nil + return result, nil } // getByVirtualMachineHandleError handles the GetByVirtualMachine error response. -func (client *VirtualMachineRunCommandsClient) getByVirtualMachineHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineRunCommandsClient) getByVirtualMachineHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - Lists all available run commands for a subscription in a location. // If the operation fails it returns a generic error. -func (client *VirtualMachineRunCommandsClient) List(location string, options *VirtualMachineRunCommandsListOptions) RunCommandListResultPager { - return &runCommandListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachineRunCommandsClient) List(location string, options *VirtualMachineRunCommandsListOptions) *VirtualMachineRunCommandsListPager { + return &VirtualMachineRunCommandsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, location, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp RunCommandListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.RunCommandListResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachineRunCommandsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.RunCommandListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *VirtualMachineRunCommandsClient) listCreateRequest(ctx context.Context, location string, options *VirtualMachineRunCommandsListOptions) (*azcore.Request, error) { +func (client *VirtualMachineRunCommandsClient) listCreateRequest(ctx context.Context, location string, options *VirtualMachineRunCommandsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -415,58 +356,54 @@ func (client *VirtualMachineRunCommandsClient) listCreateRequest(ctx context.Con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachineRunCommandsClient) listHandleResponse(resp *azcore.Response) (RunCommandListResultResponse, error) { - var val *RunCommandListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RunCommandListResultResponse{}, err +func (client *VirtualMachineRunCommandsClient) listHandleResponse(resp *http.Response) (VirtualMachineRunCommandsListResponse, error) { + result := VirtualMachineRunCommandsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RunCommandListResult); err != nil { + return VirtualMachineRunCommandsListResponse{}, err } - return RunCommandListResultResponse{RawResponse: resp.Response, RunCommandListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachineRunCommandsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineRunCommandsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListByVirtualMachine - The operation to get all run commands of a Virtual Machine. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineRunCommandsClient) ListByVirtualMachine(resourceGroupName string, vmName string, options *VirtualMachineRunCommandsListByVirtualMachineOptions) VirtualMachineRunCommandsListResultPager { - return &virtualMachineRunCommandsListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachineRunCommandsClient) ListByVirtualMachine(resourceGroupName string, vmName string, options *VirtualMachineRunCommandsListByVirtualMachineOptions) *VirtualMachineRunCommandsListByVirtualMachinePager { + return &VirtualMachineRunCommandsListByVirtualMachinePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByVirtualMachineCreateRequest(ctx, resourceGroupName, vmName, options) }, - responder: client.listByVirtualMachineHandleResponse, - errorer: client.listByVirtualMachineHandleError, - advancer: func(ctx context.Context, resp VirtualMachineRunCommandsListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineRunCommandsListResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachineRunCommandsListByVirtualMachineResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineRunCommandsListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByVirtualMachineCreateRequest creates the ListByVirtualMachine request. -func (client *VirtualMachineRunCommandsClient) listByVirtualMachineCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachineRunCommandsListByVirtualMachineOptions) (*azcore.Request, error) { +func (client *VirtualMachineRunCommandsClient) listByVirtualMachineCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachineRunCommandsListByVirtualMachineOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -480,110 +417,81 @@ func (client *VirtualMachineRunCommandsClient) listByVirtualMachineCreateRequest return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") return req, nil } // listByVirtualMachineHandleResponse handles the ListByVirtualMachine response. -func (client *VirtualMachineRunCommandsClient) listByVirtualMachineHandleResponse(resp *azcore.Response) (VirtualMachineRunCommandsListResultResponse, error) { - var val *VirtualMachineRunCommandsListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineRunCommandsListResultResponse{}, err +func (client *VirtualMachineRunCommandsClient) listByVirtualMachineHandleResponse(resp *http.Response) (VirtualMachineRunCommandsListByVirtualMachineResponse, error) { + result := VirtualMachineRunCommandsListByVirtualMachineResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommandsListResult); err != nil { + return VirtualMachineRunCommandsListByVirtualMachineResponse{}, err } - return VirtualMachineRunCommandsListResultResponse{RawResponse: resp.Response, VirtualMachineRunCommandsListResult: val}, nil + return result, nil } // listByVirtualMachineHandleError handles the ListByVirtualMachine error response. -func (client *VirtualMachineRunCommandsClient) listByVirtualMachineHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineRunCommandsClient) listByVirtualMachineHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - The operation to update the run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineRunCommandsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsBeginUpdateOptions) (VirtualMachineRunCommandPollerResponse, error) { +func (client *VirtualMachineRunCommandsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsBeginUpdateOptions) (VirtualMachineRunCommandsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err - } - result := VirtualMachineRunCommandPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineRunCommandsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err + return VirtualMachineRunCommandsUpdatePollerResponse{}, err } - poller := &virtualMachineRunCommandPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineRunCommandResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineRunCommandsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new VirtualMachineRunCommandPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineRunCommandPoller.ResumeToken(). -func (client *VirtualMachineRunCommandsClient) ResumeUpdate(ctx context.Context, token string) (VirtualMachineRunCommandPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineRunCommandsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineRunCommandsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err + return VirtualMachineRunCommandsUpdatePollerResponse{}, err } - poller := &virtualMachineRunCommandPoller{ + result.Poller = &VirtualMachineRunCommandsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err - } - result := VirtualMachineRunCommandPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineRunCommandResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - The operation to update the run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsBeginUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, runCommandName, runCommand, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *VirtualMachineRunCommandsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsBeginUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineRunCommandsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineRunCommandsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -601,27 +509,26 @@ func (client *VirtualMachineRunCommandsClient) updateCreateRequest(ctx context.C return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") - return req, req.MarshalAsJSON(runCommand) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") + return req, runtime.MarshalAsJSON(req, runCommand) } // updateHandleError handles the Update error response. -func (client *VirtualMachineRunCommandsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineRunCommandsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachines_client.go b/sdk/compute/armcompute/zz_generated_virtualmachines_client.go index 4e7018a7e9d4..34a6dd3be6a6 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachines_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachines_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,94 +12,69 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strconv" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachinesClient contains the methods for the VirtualMachines group. // Don't use this type directly, use NewVirtualMachinesClient() instead. type VirtualMachinesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachinesClient creates a new instance of VirtualMachinesClient with the specified values. -func NewVirtualMachinesClient(con *armcore.Connection, subscriptionID string) *VirtualMachinesClient { - return &VirtualMachinesClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachinesClient(con *arm.Connection, subscriptionID string) *VirtualMachinesClient { + return &VirtualMachinesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginAssessPatches - Assess patches on the VM. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachinesClient) BeginAssessPatches(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginAssessPatchesOptions) (VirtualMachineAssessPatchesResultPollerResponse, error) { +func (client *VirtualMachinesClient) BeginAssessPatches(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginAssessPatchesOptions) (VirtualMachinesAssessPatchesPollerResponse, error) { resp, err := client.assessPatches(ctx, resourceGroupName, vmName, options) if err != nil { - return VirtualMachineAssessPatchesResultPollerResponse{}, err + return VirtualMachinesAssessPatchesPollerResponse{}, err } - result := VirtualMachineAssessPatchesResultPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachinesAssessPatchesPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.AssessPatches", "location", resp, client.con.Pipeline(), client.assessPatchesHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.AssessPatches", "location", resp, client.pl, client.assessPatchesHandleError) if err != nil { - return VirtualMachineAssessPatchesResultPollerResponse{}, err + return VirtualMachinesAssessPatchesPollerResponse{}, err } - poller := &virtualMachineAssessPatchesResultPoller{ + result.Poller = &VirtualMachinesAssessPatchesPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineAssessPatchesResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeAssessPatches creates a new VirtualMachineAssessPatchesResultPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineAssessPatchesResultPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeAssessPatches(ctx context.Context, token string) (VirtualMachineAssessPatchesResultPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.AssessPatches", token, client.con.Pipeline(), client.assessPatchesHandleError) - if err != nil { - return VirtualMachineAssessPatchesResultPollerResponse{}, err - } - poller := &virtualMachineAssessPatchesResultPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineAssessPatchesResultPollerResponse{}, err - } - result := VirtualMachineAssessPatchesResultPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineAssessPatchesResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // AssessPatches - Assess patches on the VM. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachinesClient) assessPatches(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginAssessPatchesOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) assessPatches(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginAssessPatchesOptions) (*http.Response, error) { req, err := client.assessPatchesCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.assessPatchesHandleError(resp) } return resp, nil } // assessPatchesCreateRequest creates the AssessPatches request. -func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginAssessPatchesOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginAssessPatchesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -112,98 +88,69 @@ func (client *VirtualMachinesClient) assessPatchesCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // assessPatchesHandleError handles the AssessPatches error response. -func (client *VirtualMachinesClient) assessPatchesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) assessPatchesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginCapture - Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginCapture(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesBeginCaptureOptions) (VirtualMachineCaptureResultPollerResponse, error) { +func (client *VirtualMachinesClient) BeginCapture(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesBeginCaptureOptions) (VirtualMachinesCapturePollerResponse, error) { resp, err := client.capture(ctx, resourceGroupName, vmName, parameters, options) if err != nil { - return VirtualMachineCaptureResultPollerResponse{}, err + return VirtualMachinesCapturePollerResponse{}, err } - result := VirtualMachineCaptureResultPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachinesCapturePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.Capture", "location", resp, client.con.Pipeline(), client.captureHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.Capture", "location", resp, client.pl, client.captureHandleError) if err != nil { - return VirtualMachineCaptureResultPollerResponse{}, err + return VirtualMachinesCapturePollerResponse{}, err } - poller := &virtualMachineCaptureResultPoller{ + result.Poller = &VirtualMachinesCapturePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineCaptureResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCapture creates a new VirtualMachineCaptureResultPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineCaptureResultPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeCapture(ctx context.Context, token string) (VirtualMachineCaptureResultPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.Capture", token, client.con.Pipeline(), client.captureHandleError) - if err != nil { - return VirtualMachineCaptureResultPollerResponse{}, err - } - poller := &virtualMachineCaptureResultPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineCaptureResultPollerResponse{}, err - } - result := VirtualMachineCaptureResultPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineCaptureResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Capture - Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) capture(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesBeginCaptureOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) capture(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesBeginCaptureOptions) (*http.Response, error) { req, err := client.captureCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.captureHandleError(resp) } return resp, nil } // captureCreateRequest creates the Capture request. -func (client *VirtualMachinesClient) captureCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesBeginCaptureOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) captureCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, options *VirtualMachinesBeginCaptureOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -217,99 +164,70 @@ func (client *VirtualMachinesClient) captureCreateRequest(ctx context.Context, r return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // captureHandleError handles the Capture error response. -func (client *VirtualMachinesClient) captureHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) captureHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginConvertToManagedDisks - Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking // this operation. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginConvertToManagedDisks(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginConvertToManagedDisksOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachinesClient) BeginConvertToManagedDisks(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginConvertToManagedDisksOptions) (VirtualMachinesConvertToManagedDisksPollerResponse, error) { resp, err := client.convertToManagedDisks(ctx, resourceGroupName, vmName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.ConvertToManagedDisks", "", resp, client.con.Pipeline(), client.convertToManagedDisksHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return VirtualMachinesConvertToManagedDisksPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachinesConvertToManagedDisksPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeConvertToManagedDisks creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeConvertToManagedDisks(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.ConvertToManagedDisks", token, client.con.Pipeline(), client.convertToManagedDisksHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.ConvertToManagedDisks", "", resp, client.pl, client.convertToManagedDisksHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesConvertToManagedDisksPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachinesConvertToManagedDisksPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // ConvertToManagedDisks - Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this // operation. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) convertToManagedDisks(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginConvertToManagedDisksOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) convertToManagedDisks(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginConvertToManagedDisksOptions) (*http.Response, error) { req, err := client.convertToManagedDisksCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.convertToManagedDisksHandleError(resp) } return resp, nil } // convertToManagedDisksCreateRequest creates the ConvertToManagedDisks request. -func (client *VirtualMachinesClient) convertToManagedDisksCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginConvertToManagedDisksOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) convertToManagedDisksCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginConvertToManagedDisksOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -323,96 +241,67 @@ func (client *VirtualMachinesClient) convertToManagedDisksCreateRequest(ctx cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // convertToManagedDisksHandleError handles the ConvertToManagedDisks error response. -func (client *VirtualMachinesClient) convertToManagedDisksHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) convertToManagedDisksHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginCreateOrUpdate - The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesBeginCreateOrUpdateOptions) (VirtualMachinePollerResponse, error) { +func (client *VirtualMachinesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesBeginCreateOrUpdateOptions) (VirtualMachinesCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, vmName, parameters, options) if err != nil { - return VirtualMachinePollerResponse{}, err - } - result := VirtualMachinePollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return VirtualMachinePollerResponse{}, err - } - poller := &virtualMachinePoller{ - pt: pt, + return VirtualMachinesCreateOrUpdatePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachinesCreateOrUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeCreateOrUpdate creates a new VirtualMachinePoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachinePoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeCreateOrUpdate(ctx context.Context, token string) (VirtualMachinePollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return VirtualMachinePollerResponse{}, err + return VirtualMachinesCreateOrUpdatePollerResponse{}, err } - poller := &virtualMachinePoller{ + result.Poller = &VirtualMachinesCreateOrUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachinePollerResponse{}, err - } - result := VirtualMachinePollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - The operation to create or update a virtual machine. Please note some properties can be set only during virtual machine creation. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachine, options *VirtualMachinesBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -426,99 +315,70 @@ func (client *VirtualMachinesClient) createOrUpdateCreateRequest(ctx context.Con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *VirtualMachinesClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDeallocate - Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine // uses. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginDeallocate(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeallocateOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachinesClient) BeginDeallocate(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeallocateOptions) (VirtualMachinesDeallocatePollerResponse, error) { resp, err := client.deallocate(ctx, resourceGroupName, vmName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.Deallocate", "", resp, client.con.Pipeline(), client.deallocateHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesDeallocatePollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachinesDeallocatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDeallocate creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeDeallocate(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.Deallocate", token, client.con.Pipeline(), client.deallocateHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.Deallocate", "", resp, client.pl, client.deallocateHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesDeallocatePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachinesDeallocatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Deallocate - Shuts down the virtual machine and releases the compute resources. You are not billed for the compute resources that this virtual machine // uses. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) deallocate(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeallocateOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) deallocate(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeallocateOptions) (*http.Response, error) { req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.deallocateHandleError(resp) } return resp, nil } // deallocateCreateRequest creates the Deallocate request. -func (client *VirtualMachinesClient) deallocateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeallocateOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) deallocateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeallocateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -532,96 +392,70 @@ func (client *VirtualMachinesClient) deallocateCreateRequest(ctx context.Context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + if options != nil && options.Hibernate != nil { + reqQP.Set("hibernate", strconv.FormatBool(*options.Hibernate)) + } + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deallocateHandleError handles the Deallocate error response. -func (client *VirtualMachinesClient) deallocateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) deallocateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDelete - The operation to delete a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginDelete(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachinesClient) BeginDelete(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeleteOptions) (VirtualMachinesDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, vmName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesDeletePollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachinesDeletePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachinesDeletePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - The operation to delete a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeleteOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) deleteOperation(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeleteOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -635,30 +469,29 @@ func (client *VirtualMachinesClient) deleteCreateRequest(ctx context.Context, re return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *VirtualMachinesClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Generalize - Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the virtual machine before performing this operation. @@ -667,23 +500,23 @@ func (client *VirtualMachinesClient) deleteHandleError(resp *azcore.Response) er // an image of a virtual machine or VHD // [https://docs.microsoft.com/azure/virtual-machines/linux/capture-image]. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) Generalize(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesGeneralizeOptions) (*http.Response, error) { +func (client *VirtualMachinesClient) Generalize(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesGeneralizeOptions) (VirtualMachinesGeneralizeResponse, error) { req, err := client.generalizeCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { - return nil, err + return VirtualMachinesGeneralizeResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return nil, err + return VirtualMachinesGeneralizeResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return nil, client.generalizeHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesGeneralizeResponse{}, client.generalizeHandleError(resp) } - return resp.Response, nil + return VirtualMachinesGeneralizeResponse{RawResponse: resp}, nil } // generalizeCreateRequest creates the Generalize request. -func (client *VirtualMachinesClient) generalizeCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesGeneralizeOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) generalizeCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesGeneralizeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -697,48 +530,47 @@ func (client *VirtualMachinesClient) generalizeCreateRequest(ctx context.Context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // generalizeHandleError handles the Generalize error response. -func (client *VirtualMachinesClient) generalizeHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) generalizeHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Retrieves information about the model view or the instance view of a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesGetOptions) (VirtualMachineResponse, error) { +func (client *VirtualMachinesClient) Get(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesGetOptions) (VirtualMachinesGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { - return VirtualMachineResponse{}, err + return VirtualMachinesGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineResponse{}, err + return VirtualMachinesGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesGetOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -752,109 +584,80 @@ func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resou return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachinesClient) getHandleResponse(resp *azcore.Response) (VirtualMachineResponse, error) { - var val *VirtualMachine - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineResponse{}, err +func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (VirtualMachinesGetResponse, error) { + result := VirtualMachinesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachine); err != nil { + return VirtualMachinesGetResponse{}, err } - return VirtualMachineResponse{RawResponse: resp.Response, VirtualMachine: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachinesClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginInstallPatches - Installs patches on the VM. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachinesClient) BeginInstallPatches(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesBeginInstallPatchesOptions) (VirtualMachineInstallPatchesResultPollerResponse, error) { +func (client *VirtualMachinesClient) BeginInstallPatches(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesBeginInstallPatchesOptions) (VirtualMachinesInstallPatchesPollerResponse, error) { resp, err := client.installPatches(ctx, resourceGroupName, vmName, installPatchesInput, options) if err != nil { - return VirtualMachineInstallPatchesResultPollerResponse{}, err - } - result := VirtualMachineInstallPatchesResultPollerResponse{ - RawResponse: resp.Response, + return VirtualMachinesInstallPatchesPollerResponse{}, err } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.InstallPatches", "location", resp, client.con.Pipeline(), client.installPatchesHandleError) - if err != nil { - return VirtualMachineInstallPatchesResultPollerResponse{}, err - } - poller := &virtualMachineInstallPatchesResultPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineInstallPatchesResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachinesInstallPatchesPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeInstallPatches creates a new VirtualMachineInstallPatchesResultPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineInstallPatchesResultPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeInstallPatches(ctx context.Context, token string) (VirtualMachineInstallPatchesResultPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.InstallPatches", token, client.con.Pipeline(), client.installPatchesHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.InstallPatches", "location", resp, client.pl, client.installPatchesHandleError) if err != nil { - return VirtualMachineInstallPatchesResultPollerResponse{}, err + return VirtualMachinesInstallPatchesPollerResponse{}, err } - poller := &virtualMachineInstallPatchesResultPoller{ + result.Poller = &VirtualMachinesInstallPatchesPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineInstallPatchesResultPollerResponse{}, err - } - result := VirtualMachineInstallPatchesResultPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineInstallPatchesResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // InstallPatches - Installs patches on the VM. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachinesClient) installPatches(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesBeginInstallPatchesOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) installPatches(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesBeginInstallPatchesOptions) (*http.Response, error) { req, err := client.installPatchesCreateRequest(ctx, resourceGroupName, vmName, installPatchesInput, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.installPatchesHandleError(resp) } return resp, nil } // installPatchesCreateRequest creates the InstallPatches request. -func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesBeginInstallPatchesOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Context, resourceGroupName string, vmName string, installPatchesInput VirtualMachineInstallPatchesParameters, options *VirtualMachinesBeginInstallPatchesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -868,50 +671,49 @@ func (client *VirtualMachinesClient) installPatchesCreateRequest(ctx context.Con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(installPatchesInput) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, installPatchesInput) } // installPatchesHandleError handles the InstallPatches error response. -func (client *VirtualMachinesClient) installPatchesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) installPatchesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // InstanceView - Retrieves information about the run-time state of a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) InstanceView(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesInstanceViewOptions) (VirtualMachineInstanceViewResponse, error) { +func (client *VirtualMachinesClient) InstanceView(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesInstanceViewOptions) (VirtualMachinesInstanceViewResponse, error) { req, err := client.instanceViewCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { - return VirtualMachineInstanceViewResponse{}, err + return VirtualMachinesInstanceViewResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineInstanceViewResponse{}, err + return VirtualMachinesInstanceViewResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineInstanceViewResponse{}, client.instanceViewHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesInstanceViewResponse{}, client.instanceViewHandleError(resp) } return client.instanceViewHandleResponse(resp) } // instanceViewCreateRequest creates the InstanceView request. -func (client *VirtualMachinesClient) instanceViewCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesInstanceViewOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) instanceViewCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesInstanceViewOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -925,58 +727,54 @@ func (client *VirtualMachinesClient) instanceViewCreateRequest(ctx context.Conte return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // instanceViewHandleResponse handles the InstanceView response. -func (client *VirtualMachinesClient) instanceViewHandleResponse(resp *azcore.Response) (VirtualMachineInstanceViewResponse, error) { - var val *VirtualMachineInstanceView - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineInstanceViewResponse{}, err +func (client *VirtualMachinesClient) instanceViewHandleResponse(resp *http.Response) (VirtualMachinesInstanceViewResponse, error) { + result := VirtualMachinesInstanceViewResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineInstanceView); err != nil { + return VirtualMachinesInstanceViewResponse{}, err } - return VirtualMachineInstanceViewResponse{RawResponse: resp.Response, VirtualMachineInstanceView: val}, nil + return result, nil } // instanceViewHandleError handles the InstanceView error response. -func (client *VirtualMachinesClient) instanceViewHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) instanceViewHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - 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. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) List(resourceGroupName string, options *VirtualMachinesListOptions) VirtualMachineListResultPager { - return &virtualMachineListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachinesClient) List(resourceGroupName string, options *VirtualMachinesListOptions) *VirtualMachinesListPager { + return &VirtualMachinesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp VirtualMachineListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineListResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachinesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualMachinesListOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualMachinesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -986,119 +784,114 @@ func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, reso return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachinesClient) listHandleResponse(resp *azcore.Response) (VirtualMachineListResultResponse, error) { - var val *VirtualMachineListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineListResultResponse{}, err +func (client *VirtualMachinesClient) listHandleResponse(resp *http.Response) (VirtualMachinesListResponse, error) { + result := VirtualMachinesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResult); err != nil { + return VirtualMachinesListResponse{}, err } - return VirtualMachineListResultResponse{RawResponse: resp.Response, VirtualMachineListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachinesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListAll - 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. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) ListAll(options *VirtualMachinesListAllOptions) VirtualMachineListResultPager { - return &virtualMachineListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachinesClient) ListAll(options *VirtualMachinesListAllOptions) *VirtualMachinesListAllPager { + return &VirtualMachinesListAllPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listAllCreateRequest(ctx, options) }, - responder: client.listAllHandleResponse, - errorer: client.listAllHandleError, - advancer: func(ctx context.Context, resp VirtualMachineListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineListResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachinesListAllResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listAllCreateRequest creates the ListAll request. -func (client *VirtualMachinesClient) listAllCreateRequest(ctx context.Context, options *VirtualMachinesListAllOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) listAllCreateRequest(ctx context.Context, options *VirtualMachinesListAllOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") if options != nil && options.StatusOnly != nil { reqQP.Set("statusOnly", *options.StatusOnly) } - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listAllHandleResponse handles the ListAll response. -func (client *VirtualMachinesClient) listAllHandleResponse(resp *azcore.Response) (VirtualMachineListResultResponse, error) { - var val *VirtualMachineListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineListResultResponse{}, err +func (client *VirtualMachinesClient) listAllHandleResponse(resp *http.Response) (VirtualMachinesListAllResponse, error) { + result := VirtualMachinesListAllResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResult); err != nil { + return VirtualMachinesListAllResponse{}, err } - return VirtualMachineListResultResponse{RawResponse: resp.Response, VirtualMachineListResult: val}, nil + return result, nil } // listAllHandleError handles the ListAll error response. -func (client *VirtualMachinesClient) listAllHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) listAllHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListAvailableSizes - Lists all available virtual machine sizes to which the specified virtual machine can be resized. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesListAvailableSizesOptions) (VirtualMachineSizeListResultResponse, error) { +func (client *VirtualMachinesClient) ListAvailableSizes(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesListAvailableSizesOptions) (VirtualMachinesListAvailableSizesResponse, error) { req, err := client.listAvailableSizesCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { - return VirtualMachineSizeListResultResponse{}, err + return VirtualMachinesListAvailableSizesResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineSizeListResultResponse{}, err + return VirtualMachinesListAvailableSizesResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineSizeListResultResponse{}, client.listAvailableSizesHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesListAvailableSizesResponse{}, client.listAvailableSizesHandleError(resp) } return client.listAvailableSizesHandleResponse(resp) } // listAvailableSizesCreateRequest creates the ListAvailableSizes request. -func (client *VirtualMachinesClient) listAvailableSizesCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesListAvailableSizesOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) listAvailableSizesCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesListAvailableSizesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1112,58 +905,54 @@ func (client *VirtualMachinesClient) listAvailableSizesCreateRequest(ctx context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listAvailableSizesHandleResponse handles the ListAvailableSizes response. -func (client *VirtualMachinesClient) listAvailableSizesHandleResponse(resp *azcore.Response) (VirtualMachineSizeListResultResponse, error) { - var val *VirtualMachineSizeListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineSizeListResultResponse{}, err +func (client *VirtualMachinesClient) listAvailableSizesHandleResponse(resp *http.Response) (VirtualMachinesListAvailableSizesResponse, error) { + result := VirtualMachinesListAvailableSizesResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineSizeListResult); err != nil { + return VirtualMachinesListAvailableSizesResponse{}, err } - return VirtualMachineSizeListResultResponse{RawResponse: resp.Response, VirtualMachineSizeListResult: val}, nil + return result, nil } // listAvailableSizesHandleError handles the ListAvailableSizes error response. -func (client *VirtualMachinesClient) listAvailableSizesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) listAvailableSizesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListByLocation - Gets all the virtual machines under the specified subscription for the specified location. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) ListByLocation(location string, options *VirtualMachinesListByLocationOptions) VirtualMachineListResultPager { - return &virtualMachineListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachinesClient) ListByLocation(location string, options *VirtualMachinesListByLocationOptions) *VirtualMachinesListByLocationPager { + return &VirtualMachinesListByLocationPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByLocationCreateRequest(ctx, location, options) }, - responder: client.listByLocationHandleResponse, - errorer: client.listByLocationHandleError, - advancer: func(ctx context.Context, resp VirtualMachineListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineListResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachinesListByLocationResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByLocationCreateRequest creates the ListByLocation request. -func (client *VirtualMachinesClient) listByLocationCreateRequest(ctx context.Context, location string, options *VirtualMachinesListByLocationOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) listByLocationCreateRequest(ctx context.Context, location string, options *VirtualMachinesListByLocationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -1173,106 +962,77 @@ func (client *VirtualMachinesClient) listByLocationCreateRequest(ctx context.Con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByLocationHandleResponse handles the ListByLocation response. -func (client *VirtualMachinesClient) listByLocationHandleResponse(resp *azcore.Response) (VirtualMachineListResultResponse, error) { - var val *VirtualMachineListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineListResultResponse{}, err +func (client *VirtualMachinesClient) listByLocationHandleResponse(resp *http.Response) (VirtualMachinesListByLocationResponse, error) { + result := VirtualMachinesListByLocationResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResult); err != nil { + return VirtualMachinesListByLocationResponse{}, err } - return VirtualMachineListResultResponse{RawResponse: resp.Response, VirtualMachineListResult: val}, nil + return result, nil } // listByLocationHandleError handles the ListByLocation error response. -func (client *VirtualMachinesClient) listByLocationHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) listByLocationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginPerformMaintenance - The operation to perform maintenance on a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginPerformMaintenance(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPerformMaintenanceOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachinesClient) BeginPerformMaintenance(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPerformMaintenanceOptions) (VirtualMachinesPerformMaintenancePollerResponse, error) { resp, err := client.performMaintenance(ctx, resourceGroupName, vmName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesPerformMaintenancePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachinesPerformMaintenancePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.PerformMaintenance", "", resp, client.con.Pipeline(), client.performMaintenanceHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.PerformMaintenance", "", resp, client.pl, client.performMaintenanceHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesPerformMaintenancePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachinesPerformMaintenancePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumePerformMaintenance creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumePerformMaintenance(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.PerformMaintenance", token, client.con.Pipeline(), client.performMaintenanceHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // PerformMaintenance - The operation to perform maintenance on a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) performMaintenance(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPerformMaintenanceOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) performMaintenance(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPerformMaintenanceOptions) (*http.Response, error) { req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.performMaintenanceHandleError(resp) } return resp, nil } // performMaintenanceCreateRequest creates the PerformMaintenance request. -func (client *VirtualMachinesClient) performMaintenanceCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPerformMaintenanceOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) performMaintenanceCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPerformMaintenanceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1286,98 +1046,69 @@ func (client *VirtualMachinesClient) performMaintenanceCreateRequest(ctx context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // performMaintenanceHandleError handles the PerformMaintenance error response. -func (client *VirtualMachinesClient) performMaintenanceHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) performMaintenanceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginPowerOff - The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are // still charged for this virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginPowerOff(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPowerOffOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachinesClient) BeginPowerOff(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPowerOffOptions) (VirtualMachinesPowerOffPollerResponse, error) { resp, err := client.powerOff(ctx, resourceGroupName, vmName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.PowerOff", "", resp, client.con.Pipeline(), client.powerOffHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return VirtualMachinesPowerOffPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachinesPowerOffPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumePowerOff creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumePowerOff(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.PowerOff", token, client.con.Pipeline(), client.powerOffHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.PowerOff", "", resp, client.pl, client.powerOffHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesPowerOffPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachinesPowerOffPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // PowerOff - The operation to power off (stop) a virtual machine. The virtual machine can be restarted with the same provisioned resources. You are still // charged for this virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) powerOff(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPowerOffOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) powerOff(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPowerOffOptions) (*http.Response, error) { req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.powerOffHandleError(resp) } return resp, nil } // powerOffCreateRequest creates the PowerOff request. -func (client *VirtualMachinesClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPowerOffOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginPowerOffOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1391,99 +1122,70 @@ func (client *VirtualMachinesClient) powerOffCreateRequest(ctx context.Context, return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.SkipShutdown != nil { reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // powerOffHandleError handles the PowerOff error response. -func (client *VirtualMachinesClient) powerOffHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) powerOffHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginReapply - The operation to reapply a virtual machine's state. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachinesClient) BeginReapply(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReapplyOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachinesClient) BeginReapply(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReapplyOptions) (VirtualMachinesReapplyPollerResponse, error) { resp, err := client.reapply(ctx, resourceGroupName, vmName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesReapplyPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachinesReapplyPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.Reapply", "", resp, client.con.Pipeline(), client.reapplyHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.Reapply", "", resp, client.pl, client.reapplyHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesReapplyPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachinesReapplyPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeReapply creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeReapply(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.Reapply", token, client.con.Pipeline(), client.reapplyHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Reapply - The operation to reapply a virtual machine's state. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachinesClient) reapply(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReapplyOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) reapply(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReapplyOptions) (*http.Response, error) { req, err := client.reapplyCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.reapplyHandleError(resp) } return resp, nil } // reapplyCreateRequest creates the Reapply request. -func (client *VirtualMachinesClient) reapplyCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReapplyOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) reapplyCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReapplyOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1497,98 +1199,69 @@ func (client *VirtualMachinesClient) reapplyCreateRequest(ctx context.Context, r return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // reapplyHandleError handles the Reapply error response. -func (client *VirtualMachinesClient) reapplyHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) reapplyHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginRedeploy - Shuts down the virtual machine, moves it to a new node, and powers it back on. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginRedeploy(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRedeployOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachinesClient) BeginRedeploy(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRedeployOptions) (VirtualMachinesRedeployPollerResponse, error) { resp, err := client.redeploy(ctx, resourceGroupName, vmName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesRedeployPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachinesRedeployPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.Redeploy", "", resp, client.con.Pipeline(), client.redeployHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.Redeploy", "", resp, client.pl, client.redeployHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesRedeployPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachinesRedeployPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeRedeploy creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeRedeploy(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.Redeploy", token, client.con.Pipeline(), client.redeployHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Redeploy - Shuts down the virtual machine, moves it to a new node, and powers it back on. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRedeployOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) redeploy(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.redeployHandleError(resp) } return resp, nil } // redeployCreateRequest creates the Redeploy request. -func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRedeployOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRedeployOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1602,96 +1275,67 @@ func (client *VirtualMachinesClient) redeployCreateRequest(ctx context.Context, return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // redeployHandleError handles the Redeploy error response. -func (client *VirtualMachinesClient) redeployHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) redeployHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginReimage - Reimages the virtual machine which has an ephemeral OS disk back to its initial state. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginReimage(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReimageOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachinesClient) BeginReimage(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReimageOptions) (VirtualMachinesReimagePollerResponse, error) { resp, err := client.reimage(ctx, resourceGroupName, vmName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesReimagePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.Reimage", "", resp, client.con.Pipeline(), client.reimageHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachinesReimagePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeReimage creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeReimage(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.Reimage", token, client.con.Pipeline(), client.reimageHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.Reimage", "", resp, client.pl, client.reimageHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesReimagePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachinesReimagePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Reimage - Reimages the virtual machine which has an ephemeral OS disk back to its initial state. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) reimage(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReimageOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) reimage(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.reimageHandleError(resp) } return resp, nil } // reimageCreateRequest creates the Reimage request. -func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReimageOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginReimageOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1705,99 +1349,70 @@ func (client *VirtualMachinesClient) reimageCreateRequest(ctx context.Context, r return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.Parameters != nil { - return req, req.MarshalAsJSON(*options.Parameters) + return req, runtime.MarshalAsJSON(req, *options.Parameters) } return req, nil } // reimageHandleError handles the Reimage error response. -func (client *VirtualMachinesClient) reimageHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) reimageHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginRestart - The operation to restart a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginRestart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRestartOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachinesClient) BeginRestart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRestartOptions) (VirtualMachinesRestartPollerResponse, error) { resp, err := client.restart(ctx, resourceGroupName, vmName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesRestartPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachinesRestartPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.Restart", "", resp, client.con.Pipeline(), client.restartHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.Restart", "", resp, client.pl, client.restartHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesRestartPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachinesRestartPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeRestart creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeRestart(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.Restart", token, client.con.Pipeline(), client.restartHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Restart - The operation to restart a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) restart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRestartOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) restart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.restartHandleError(resp) } return resp, nil } // restartCreateRequest creates the Restart request. -func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRestartOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginRestartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1811,48 +1426,47 @@ func (client *VirtualMachinesClient) restartCreateRequest(ctx context.Context, r return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // restartHandleError handles the Restart error response. -func (client *VirtualMachinesClient) restartHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) restartHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // RetrieveBootDiagnosticsData - The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachinesClient) RetrieveBootDiagnosticsData(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesRetrieveBootDiagnosticsDataOptions) (RetrieveBootDiagnosticsDataResultResponse, error) { +func (client *VirtualMachinesClient) RetrieveBootDiagnosticsData(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesRetrieveBootDiagnosticsDataOptions) (VirtualMachinesRetrieveBootDiagnosticsDataResponse, error) { req, err := client.retrieveBootDiagnosticsDataCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { - return RetrieveBootDiagnosticsDataResultResponse{}, err + return VirtualMachinesRetrieveBootDiagnosticsDataResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RetrieveBootDiagnosticsDataResultResponse{}, err + return VirtualMachinesRetrieveBootDiagnosticsDataResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return RetrieveBootDiagnosticsDataResultResponse{}, client.retrieveBootDiagnosticsDataHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachinesRetrieveBootDiagnosticsDataResponse{}, client.retrieveBootDiagnosticsDataHandleError(resp) } return client.retrieveBootDiagnosticsDataHandleResponse(resp) } // retrieveBootDiagnosticsDataCreateRequest creates the RetrieveBootDiagnosticsData request. -func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesRetrieveBootDiagnosticsDataOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesRetrieveBootDiagnosticsDataOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1866,110 +1480,81 @@ func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataCreateRequest(ct return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.SasURIExpirationTimeInMinutes != nil { reqQP.Set("sasUriExpirationTimeInMinutes", strconv.FormatInt(int64(*options.SasURIExpirationTimeInMinutes), 10)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // retrieveBootDiagnosticsDataHandleResponse handles the RetrieveBootDiagnosticsData response. -func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataHandleResponse(resp *azcore.Response) (RetrieveBootDiagnosticsDataResultResponse, error) { - var val *RetrieveBootDiagnosticsDataResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RetrieveBootDiagnosticsDataResultResponse{}, err +func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataHandleResponse(resp *http.Response) (VirtualMachinesRetrieveBootDiagnosticsDataResponse, error) { + result := VirtualMachinesRetrieveBootDiagnosticsDataResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RetrieveBootDiagnosticsDataResult); err != nil { + return VirtualMachinesRetrieveBootDiagnosticsDataResponse{}, err } - return RetrieveBootDiagnosticsDataResultResponse{RawResponse: resp.Response, RetrieveBootDiagnosticsDataResult: val}, nil + return result, nil } // retrieveBootDiagnosticsDataHandleError handles the RetrieveBootDiagnosticsData error response. -func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginRunCommand - Run command on the VM. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginRunCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesBeginRunCommandOptions) (RunCommandResultPollerResponse, error) { +func (client *VirtualMachinesClient) BeginRunCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesBeginRunCommandOptions) (VirtualMachinesRunCommandPollerResponse, error) { resp, err := client.runCommand(ctx, resourceGroupName, vmName, parameters, options) if err != nil { - return RunCommandResultPollerResponse{}, err + return VirtualMachinesRunCommandPollerResponse{}, err } - result := RunCommandResultPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachinesRunCommandPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.RunCommand", "location", resp, client.con.Pipeline(), client.runCommandHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.RunCommand", "location", resp, client.pl, client.runCommandHandleError) if err != nil { - return RunCommandResultPollerResponse{}, err + return VirtualMachinesRunCommandPollerResponse{}, err } - poller := &runCommandResultPoller{ + result.Poller = &VirtualMachinesRunCommandPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (RunCommandResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeRunCommand creates a new RunCommandResultPoller from the specified resume token. -// token - The value must come from a previous call to RunCommandResultPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeRunCommand(ctx context.Context, token string) (RunCommandResultPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.RunCommand", token, client.con.Pipeline(), client.runCommandHandleError) - if err != nil { - return RunCommandResultPollerResponse{}, err - } - poller := &runCommandResultPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return RunCommandResultPollerResponse{}, err - } - result := RunCommandResultPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (RunCommandResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // RunCommand - Run command on the VM. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) runCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesBeginRunCommandOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) runCommand(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesBeginRunCommandOptions) (*http.Response, error) { req, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.runCommandHandleError(resp) } return resp, nil } // runCommandCreateRequest creates the RunCommand request. -func (client *VirtualMachinesClient) runCommandCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesBeginRunCommandOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) runCommandCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters RunCommandInput, options *VirtualMachinesBeginRunCommandOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1983,49 +1568,48 @@ func (client *VirtualMachinesClient) runCommandCreateRequest(ctx context.Context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") + return req, runtime.MarshalAsJSON(req, parameters) } // runCommandHandleError handles the RunCommand error response. -func (client *VirtualMachinesClient) runCommandHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) runCommandHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // SimulateEviction - The operation to simulate the eviction of spot virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) SimulateEviction(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesSimulateEvictionOptions) (*http.Response, error) { +func (client *VirtualMachinesClient) SimulateEviction(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesSimulateEvictionOptions) (VirtualMachinesSimulateEvictionResponse, error) { req, err := client.simulateEvictionCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { - return nil, err + return VirtualMachinesSimulateEvictionResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return nil, err + return VirtualMachinesSimulateEvictionResponse{}, err } - if !resp.HasStatusCode(http.StatusNoContent) { - return nil, client.simulateEvictionHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return VirtualMachinesSimulateEvictionResponse{}, client.simulateEvictionHandleError(resp) } - return resp.Response, nil + return VirtualMachinesSimulateEvictionResponse{RawResponse: resp}, nil } // simulateEvictionCreateRequest creates the SimulateEviction request. -func (client *VirtualMachinesClient) simulateEvictionCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesSimulateEvictionOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) simulateEvictionCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesSimulateEvictionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -2039,96 +1623,67 @@ func (client *VirtualMachinesClient) simulateEvictionCreateRequest(ctx context.C return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // simulateEvictionHandleError handles the SimulateEviction error response. -func (client *VirtualMachinesClient) simulateEvictionHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) simulateEvictionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginStart - The operation to start a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginStartOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachinesClient) BeginStart(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginStartOptions) (VirtualMachinesStartPollerResponse, error) { resp, err := client.start(ctx, resourceGroupName, vmName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesStartPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachinesStartPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.Start", "", resp, client.con.Pipeline(), client.startHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.Start", "", resp, client.pl, client.startHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachinesStartPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachinesStartPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeStart creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeStart(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.Start", token, client.con.Pipeline(), client.startHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Start - The operation to start a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginStartOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) start(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, vmName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.startHandleError(resp) } return resp, nil } // startCreateRequest creates the Start request. -func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginStartOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, resourceGroupName string, vmName string, options *VirtualMachinesBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -2142,96 +1697,67 @@ func (client *VirtualMachinesClient) startCreateRequest(ctx context.Context, res return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // startHandleError handles the Start error response. -func (client *VirtualMachinesClient) startHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) startHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginUpdate - The operation to update a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesBeginUpdateOptions) (VirtualMachinePollerResponse, error) { +func (client *VirtualMachinesClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesBeginUpdateOptions) (VirtualMachinesUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, vmName, parameters, options) if err != nil { - return VirtualMachinePollerResponse{}, err + return VirtualMachinesUpdatePollerResponse{}, err } - result := VirtualMachinePollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachinesClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return VirtualMachinePollerResponse{}, err - } - poller := &virtualMachinePoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachinesUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new VirtualMachinePoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachinePoller.ResumeToken(). -func (client *VirtualMachinesClient) ResumeUpdate(ctx context.Context, token string) (VirtualMachinePollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachinesClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("VirtualMachinesClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return VirtualMachinePollerResponse{}, err + return VirtualMachinesUpdatePollerResponse{}, err } - poller := &virtualMachinePoller{ + result.Poller = &VirtualMachinesUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachinePollerResponse{}, err - } - result := VirtualMachinePollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - The operation to update a virtual machine. // If the operation fails it returns a generic error. -func (client *VirtualMachinesClient) update(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesBeginUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachinesClient) update(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesBeginUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmName string, parameters VirtualMachineUpdate, options *VirtualMachinesBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -2245,26 +1771,25 @@ func (client *VirtualMachinesClient) updateCreateRequest(ctx context.Context, re return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // updateHandleError handles the Update error response. -func (client *VirtualMachinesClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachinesClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachinescalesetextensions_client.go b/sdk/compute/armcompute/zz_generated_virtualmachinescalesetextensions_client.go index 521031e3bc2b..a4f6b67bc6f5 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachinescalesetextensions_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachinescalesetextensions_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,93 +11,68 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineScaleSetExtensionsClient contains the methods for the VirtualMachineScaleSetExtensions group. // Don't use this type directly, use NewVirtualMachineScaleSetExtensionsClient() instead. type VirtualMachineScaleSetExtensionsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineScaleSetExtensionsClient creates a new instance of VirtualMachineScaleSetExtensionsClient with the specified values. -func NewVirtualMachineScaleSetExtensionsClient(con *armcore.Connection, subscriptionID string) *VirtualMachineScaleSetExtensionsClient { - return &VirtualMachineScaleSetExtensionsClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetExtensionsClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetExtensionsClient { + return &VirtualMachineScaleSetExtensionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - The operation to create or update an extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsBeginCreateOrUpdateOptions) (VirtualMachineScaleSetExtensionPollerResponse, error) { +func (client *VirtualMachineScaleSetExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsBeginCreateOrUpdateOptions) (VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) if err != nil { - return VirtualMachineScaleSetExtensionPollerResponse{}, err + return VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse{}, err } - result := VirtualMachineScaleSetExtensionPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetExtensionsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetExtensionsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return VirtualMachineScaleSetExtensionPollerResponse{}, err + return VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse{}, err } - poller := &virtualMachineScaleSetExtensionPoller{ + result.Poller = &VirtualMachineScaleSetExtensionsCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new VirtualMachineScaleSetExtensionPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineScaleSetExtensionPoller.ResumeToken(). -func (client *VirtualMachineScaleSetExtensionsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (VirtualMachineScaleSetExtensionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetExtensionsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return VirtualMachineScaleSetExtensionPollerResponse{}, err - } - poller := &virtualMachineScaleSetExtensionPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineScaleSetExtensionPollerResponse{}, err - } - result := VirtualMachineScaleSetExtensionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - The operation to create or update an extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtension, options *VirtualMachineScaleSetExtensionsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -114,97 +90,68 @@ func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateCreateReques return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(extensionParameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, extensionParameters) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetExtensionsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDelete - The operation to delete the extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsBeginDeleteOptions) (VirtualMachineScaleSetExtensionsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetExtensionsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetExtensionsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetExtensionsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetExtensionsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetExtensionsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetExtensionsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetExtensionsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetExtensionsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - The operation to delete the extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsBeginDeleteOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *VirtualMachineScaleSetExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsBeginDeleteOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -222,48 +169,47 @@ func (client *VirtualMachineScaleSetExtensionsClient) deleteCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *VirtualMachineScaleSetExtensionsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetExtensionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - The operation to get the extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetExtensionsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsGetOptions) (VirtualMachineScaleSetExtensionResponse, error) { +func (client *VirtualMachineScaleSetExtensionsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsGetOptions) (VirtualMachineScaleSetExtensionsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, options) if err != nil { - return VirtualMachineScaleSetExtensionResponse{}, err + return VirtualMachineScaleSetExtensionsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineScaleSetExtensionResponse{}, err + return VirtualMachineScaleSetExtensionsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineScaleSetExtensionResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetExtensionsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachineScaleSetExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsGetOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, options *VirtualMachineScaleSetExtensionsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -281,61 +227,57 @@ func (client *VirtualMachineScaleSetExtensionsClient) getCreateRequest(ctx conte return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachineScaleSetExtensionsClient) getHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetExtensionResponse, error) { - var val *VirtualMachineScaleSetExtension - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetExtensionResponse{}, err +func (client *VirtualMachineScaleSetExtensionsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetExtensionsGetResponse, error) { + result := VirtualMachineScaleSetExtensionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetExtension); err != nil { + return VirtualMachineScaleSetExtensionsGetResponse{}, err } - return VirtualMachineScaleSetExtensionResponse{RawResponse: resp.Response, VirtualMachineScaleSetExtension: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachineScaleSetExtensionsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetExtensionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - Gets a list of all extensions in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetExtensionsClient) List(resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetExtensionsListOptions) VirtualMachineScaleSetExtensionListResultPager { - return &virtualMachineScaleSetExtensionListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetExtensionsClient) List(resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetExtensionsListOptions) *VirtualMachineScaleSetExtensionsListPager { + return &VirtualMachineScaleSetExtensionsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp VirtualMachineScaleSetExtensionListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetExtensionListResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachineScaleSetExtensionsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetExtensionListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *VirtualMachineScaleSetExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetExtensionsListOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetExtensionsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -349,106 +291,77 @@ func (client *VirtualMachineScaleSetExtensionsClient) listCreateRequest(ctx cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachineScaleSetExtensionsClient) listHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetExtensionListResultResponse, error) { - var val *VirtualMachineScaleSetExtensionListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetExtensionListResultResponse{}, err +func (client *VirtualMachineScaleSetExtensionsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetExtensionsListResponse, error) { + result := VirtualMachineScaleSetExtensionsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetExtensionListResult); err != nil { + return VirtualMachineScaleSetExtensionsListResponse{}, err } - return VirtualMachineScaleSetExtensionListResultResponse{RawResponse: resp.Response, VirtualMachineScaleSetExtensionListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachineScaleSetExtensionsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetExtensionsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginUpdate - The operation to update an extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsBeginUpdateOptions) (VirtualMachineScaleSetExtensionPollerResponse, error) { +func (client *VirtualMachineScaleSetExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsBeginUpdateOptions) (VirtualMachineScaleSetExtensionsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) if err != nil { - return VirtualMachineScaleSetExtensionPollerResponse{}, err - } - result := VirtualMachineScaleSetExtensionPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetExtensionsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return VirtualMachineScaleSetExtensionPollerResponse{}, err + return VirtualMachineScaleSetExtensionsUpdatePollerResponse{}, err } - poller := &virtualMachineScaleSetExtensionPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetExtensionsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new VirtualMachineScaleSetExtensionPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineScaleSetExtensionPoller.ResumeToken(). -func (client *VirtualMachineScaleSetExtensionsClient) ResumeUpdate(ctx context.Context, token string) (VirtualMachineScaleSetExtensionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetExtensionsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetExtensionsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return VirtualMachineScaleSetExtensionPollerResponse{}, err + return VirtualMachineScaleSetExtensionsUpdatePollerResponse{}, err } - poller := &virtualMachineScaleSetExtensionPoller{ + result.Poller = &VirtualMachineScaleSetExtensionsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineScaleSetExtensionPollerResponse{}, err - } - result := VirtualMachineScaleSetExtensionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - The operation to update an extension. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsBeginUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmssExtensionName, extensionParameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *VirtualMachineScaleSetExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsBeginUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmssExtensionName string, extensionParameters VirtualMachineScaleSetExtensionUpdate, options *VirtualMachineScaleSetExtensionsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -466,26 +379,25 @@ func (client *VirtualMachineScaleSetExtensionsClient) updateCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(extensionParameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, extensionParameters) } // updateHandleError handles the Update error response. -func (client *VirtualMachineScaleSetExtensionsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetExtensionsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachinescalesetrollingupgrades_client.go b/sdk/compute/armcompute/zz_generated_virtualmachinescalesetrollingupgrades_client.go index b49102f26bc8..69a8a8390d08 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachinescalesetrollingupgrades_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachinescalesetrollingupgrades_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,93 +11,68 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineScaleSetRollingUpgradesClient contains the methods for the VirtualMachineScaleSetRollingUpgrades group. // Don't use this type directly, use NewVirtualMachineScaleSetRollingUpgradesClient() instead. type VirtualMachineScaleSetRollingUpgradesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineScaleSetRollingUpgradesClient creates a new instance of VirtualMachineScaleSetRollingUpgradesClient with the specified values. -func NewVirtualMachineScaleSetRollingUpgradesClient(con *armcore.Connection, subscriptionID string) *VirtualMachineScaleSetRollingUpgradesClient { - return &VirtualMachineScaleSetRollingUpgradesClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetRollingUpgradesClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetRollingUpgradesClient { + return &VirtualMachineScaleSetRollingUpgradesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCancel - Cancels the current virtual machine scale set rolling upgrade. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginCancel(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginCancelOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginCancel(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginCancelOptions) (VirtualMachineScaleSetRollingUpgradesCancelPollerResponse, error) { resp, err := client.cancel(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetRollingUpgradesClient.Cancel", "", resp, client.con.Pipeline(), client.cancelHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return VirtualMachineScaleSetRollingUpgradesCancelPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetRollingUpgradesCancelPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeCancel creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetRollingUpgradesClient) ResumeCancel(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetRollingUpgradesClient.Cancel", token, client.con.Pipeline(), client.cancelHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetRollingUpgradesClient.Cancel", "", resp, client.pl, client.cancelHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetRollingUpgradesCancelPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetRollingUpgradesCancelPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Cancel - Cancels the current virtual machine scale set rolling upgrade. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetRollingUpgradesClient) cancel(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginCancelOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) cancel(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginCancelOptions) (*http.Response, error) { req, err := client.cancelCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.cancelHandleError(resp) } return resp, nil } // cancelCreateRequest creates the Cancel request. -func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginCancelOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginCancelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -110,48 +86,47 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelCreateRequest(c return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // cancelHandleError handles the Cancel error response. -func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetRollingUpgradesClient) cancelHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // GetLatest - Gets the status of the latest virtual machine scale set rolling upgrade. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetRollingUpgradesClient) GetLatest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesGetLatestOptions) (RollingUpgradeStatusInfoResponse, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) GetLatest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesGetLatestOptions) (VirtualMachineScaleSetRollingUpgradesGetLatestResponse, error) { req, err := client.getLatestCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return RollingUpgradeStatusInfoResponse{}, err + return VirtualMachineScaleSetRollingUpgradesGetLatestResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RollingUpgradeStatusInfoResponse{}, err + return VirtualMachineScaleSetRollingUpgradesGetLatestResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return RollingUpgradeStatusInfoResponse{}, client.getLatestHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetRollingUpgradesGetLatestResponse{}, client.getLatestHandleError(resp) } return client.getLatestHandleResponse(resp) } // getLatestCreateRequest creates the GetLatest request. -func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesGetLatestOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesGetLatestOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -165,86 +140,57 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestCreateReques return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getLatestHandleResponse handles the GetLatest response. -func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestHandleResponse(resp *azcore.Response) (RollingUpgradeStatusInfoResponse, error) { - var val *RollingUpgradeStatusInfo - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RollingUpgradeStatusInfoResponse{}, err +func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestHandleResponse(resp *http.Response) (VirtualMachineScaleSetRollingUpgradesGetLatestResponse, error) { + result := VirtualMachineScaleSetRollingUpgradesGetLatestResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RollingUpgradeStatusInfo); err != nil { + return VirtualMachineScaleSetRollingUpgradesGetLatestResponse{}, err } - return RollingUpgradeStatusInfoResponse{RawResponse: resp.Response, RollingUpgradeStatusInfo: val}, nil + return result, nil } // getLatestHandleError handles the GetLatest error response. -func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginStartExtensionUpgrade - Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to the latest available extension // version. Instances which are already running the latest extension versions // are not affected. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartExtensionUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartExtensionUpgradeOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartExtensionUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartExtensionUpgradeOptions) (VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse, error) { resp, err := client.startExtensionUpgrade(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + return VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse{}, err } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgrade", "", resp, client.con.Pipeline(), client.startExtensionUpgradeHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeStartExtensionUpgrade creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetRollingUpgradesClient) ResumeStartExtensionUpgrade(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgrade", token, client.con.Pipeline(), client.startExtensionUpgradeHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgrade", "", resp, client.pl, client.startExtensionUpgradeHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } @@ -252,23 +198,23 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) ResumeStartExtensionU // version. Instances which are already running the latest extension versions // are not affected. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartExtensionUpgradeOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartExtensionUpgradeOptions) (*http.Response, error) { req, err := client.startExtensionUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.startExtensionUpgradeHandleError(resp) } return resp, nil } // startExtensionUpgradeCreateRequest creates the StartExtensionUpgrade request. -func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgradeCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartExtensionUpgradeOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgradeCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartExtensionUpgradeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -282,76 +228,47 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgrade return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // startExtensionUpgradeHandleError handles the StartExtensionUpgrade error response. -func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgradeHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetRollingUpgradesClient) startExtensionUpgradeHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginStartOSUpgrade - Starts a rolling upgrade to move all virtual machine scale set instances to the latest available Platform Image OS version. Instances // which are already running the latest available OS version are not // affected. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartOSUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartOSUpgradeOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) BeginStartOSUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartOSUpgradeOptions) (VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse, error) { resp, err := client.startOSUpgrade(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade", "", resp, client.con.Pipeline(), client.startOSUpgradeHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeStartOSUpgrade creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetRollingUpgradesClient) ResumeStartOSUpgrade(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade", token, client.con.Pipeline(), client.startOSUpgradeHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade", "", resp, client.pl, client.startOSUpgradeHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetRollingUpgradesStartOSUpgradePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } @@ -359,23 +276,23 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) ResumeStartOSUpgrade( // which are already running the latest available OS version are not // affected. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartOSUpgradeOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgrade(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartOSUpgradeOptions) (*http.Response, error) { req, err := client.startOSUpgradeCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.startOSUpgradeHandleError(resp) } return resp, nil } // startOSUpgradeCreateRequest creates the StartOSUpgrade request. -func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgradeCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartOSUpgradeOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgradeCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetRollingUpgradesBeginStartOSUpgradeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -389,25 +306,24 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgradeCreateR return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // startOSUpgradeHandleError handles the StartOSUpgrade error response. -func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgradeHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetRollingUpgradesClient) startOSUpgradeHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachinescalesets_client.go b/sdk/compute/armcompute/zz_generated_virtualmachinescalesets_client.go index 517951e39bee..fda4ba770dd9 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachinescalesets_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachinescalesets_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,46 +12,49 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strconv" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineScaleSetsClient contains the methods for the VirtualMachineScaleSets group. // Don't use this type directly, use NewVirtualMachineScaleSetsClient() instead. type VirtualMachineScaleSetsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineScaleSetsClient creates a new instance of VirtualMachineScaleSetsClient with the specified values. -func NewVirtualMachineScaleSetsClient(con *armcore.Connection, subscriptionID string) *VirtualMachineScaleSetsClient { - return &VirtualMachineScaleSetsClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetsClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetsClient { + return &VirtualMachineScaleSetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // ConvertToSinglePlacementGroup - Converts SinglePlacementGroup property to false for a existing virtual machine scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroup(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VMScaleSetConvertToSinglePlacementGroupInput, options *VirtualMachineScaleSetsConvertToSinglePlacementGroupOptions) (*http.Response, error) { +func (client *VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroup(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VMScaleSetConvertToSinglePlacementGroupInput, options *VirtualMachineScaleSetsConvertToSinglePlacementGroupOptions) (VirtualMachineScaleSetsConvertToSinglePlacementGroupResponse, error) { req, err := client.convertToSinglePlacementGroupCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { - return nil, err + return VirtualMachineScaleSetsConvertToSinglePlacementGroupResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return nil, err + return VirtualMachineScaleSetsConvertToSinglePlacementGroupResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return nil, client.convertToSinglePlacementGroupHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsConvertToSinglePlacementGroupResponse{}, client.convertToSinglePlacementGroupHandleError(resp) } - return resp.Response, nil + return VirtualMachineScaleSetsConvertToSinglePlacementGroupResponse{RawResponse: resp}, nil } // convertToSinglePlacementGroupCreateRequest creates the ConvertToSinglePlacementGroup request. -func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VMScaleSetConvertToSinglePlacementGroupInput, options *VirtualMachineScaleSetsConvertToSinglePlacementGroupOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VMScaleSetConvertToSinglePlacementGroupInput, options *VirtualMachineScaleSetsConvertToSinglePlacementGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -64,96 +68,67 @@ func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupCreate return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, runtime.MarshalAsJSON(req, parameters) } // convertToSinglePlacementGroupHandleError handles the ConvertToSinglePlacementGroup error response. -func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) convertToSinglePlacementGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginCreateOrUpdate - Create or update a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsBeginCreateOrUpdateOptions) (VirtualMachineScaleSetPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsBeginCreateOrUpdateOptions) (VirtualMachineScaleSetsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { - return VirtualMachineScaleSetPollerResponse{}, err - } - result := VirtualMachineScaleSetPollerResponse{ - RawResponse: resp.Response, + return VirtualMachineScaleSetsCreateOrUpdatePollerResponse{}, err } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return VirtualMachineScaleSetPollerResponse{}, err - } - poller := &virtualMachineScaleSetPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeCreateOrUpdate creates a new VirtualMachineScaleSetPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineScaleSetPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (VirtualMachineScaleSetPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return VirtualMachineScaleSetPollerResponse{}, err + return VirtualMachineScaleSetsCreateOrUpdatePollerResponse{}, err } - poller := &virtualMachineScaleSetPoller{ + result.Poller = &VirtualMachineScaleSetsCreateOrUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineScaleSetPollerResponse{}, err - } - result := VirtualMachineScaleSetPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - Create or update a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualMachineScaleSetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSet, options *VirtualMachineScaleSetsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -167,77 +142,48 @@ func (client *VirtualMachineScaleSetsClient) createOrUpdateCreateRequest(ctx con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *VirtualMachineScaleSetsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDeallocate - Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute resources. You are // not billed for the compute resources that this virtual machine // scale set deallocates. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginDeallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeallocateOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginDeallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeallocateOptions) (VirtualMachineScaleSetsDeallocatePollerResponse, error) { resp, err := client.deallocate(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.Deallocate", "", resp, client.con.Pipeline(), client.deallocateHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsDeallocatePollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsDeallocatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDeallocate creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeDeallocate(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.Deallocate", token, client.con.Pipeline(), client.deallocateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.Deallocate", "", resp, client.pl, client.deallocateHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsDeallocatePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsDeallocatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } @@ -245,23 +191,23 @@ func (client *VirtualMachineScaleSetsClient) ResumeDeallocate(ctx context.Contex // billed for the compute resources that this virtual machine // scale set deallocates. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeallocateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeallocateOptions) (*http.Response, error) { req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.deallocateHandleError(resp) } return resp, nil } // deallocateCreateRequest creates the Deallocate request. -func (client *VirtualMachineScaleSetsClient) deallocateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeallocateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) deallocateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeallocateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -275,99 +221,70 @@ func (client *VirtualMachineScaleSetsClient) deallocateCreateRequest(ctx context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.VMInstanceIDs != nil { - return req, req.MarshalAsJSON(*options.VMInstanceIDs) + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) } return req, nil } // deallocateHandleError handles the Deallocate error response. -func (client *VirtualMachineScaleSetsClient) deallocateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) deallocateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDelete - Deletes a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeleteOptions) (VirtualMachineScaleSetsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + return VirtualMachineScaleSetsDeletePollerResponse{}, err } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsDeletePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsDeletePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Deletes a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeleteOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *VirtualMachineScaleSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeleteOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -381,99 +298,70 @@ func (client *VirtualMachineScaleSetsClient) deleteCreateRequest(ctx context.Con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *VirtualMachineScaleSetsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDeleteInstances - Deletes virtual machines in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginDeleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginDeleteInstancesOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginDeleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginDeleteInstancesOptions) (VirtualMachineScaleSetsDeleteInstancesPollerResponse, error) { resp, err := client.deleteInstances(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + return VirtualMachineScaleSetsDeleteInstancesPollerResponse{}, err } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.DeleteInstances", "", resp, client.con.Pipeline(), client.deleteInstancesHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsDeleteInstancesPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeDeleteInstances creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeDeleteInstances(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.DeleteInstances", token, client.con.Pipeline(), client.deleteInstancesHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.DeleteInstances", "", resp, client.pl, client.deleteInstancesHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsDeleteInstancesPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsDeleteInstancesPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // DeleteInstances - Deletes virtual machines in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) deleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginDeleteInstancesOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) deleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginDeleteInstancesOptions) (*http.Response, error) { req, err := client.deleteInstancesCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.deleteInstancesHandleError(resp) } return resp, nil } // deleteInstancesCreateRequest creates the DeleteInstances request. -func (client *VirtualMachineScaleSetsClient) deleteInstancesCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginDeleteInstancesOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) deleteInstancesCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginDeleteInstancesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -487,52 +375,51 @@ func (client *VirtualMachineScaleSetsClient) deleteInstancesCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - return req, req.MarshalAsJSON(vmInstanceIDs) + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, runtime.MarshalAsJSON(req, vmInstanceIDs) } // deleteInstancesHandleError handles the DeleteInstances error response. -func (client *VirtualMachineScaleSetsClient) deleteInstancesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) deleteInstancesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ForceRecoveryServiceFabricPlatformUpdateDomainWalk - Manual platform update domain walk to update virtual machines in a service fabric virtual machine // scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx context.Context, resourceGroupName string, vmScaleSetName string, platformUpdateDomain int32, options *VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions) (RecoveryWalkResponseResponse, error) { +func (client *VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx context.Context, resourceGroupName string, vmScaleSetName string, platformUpdateDomain int32, options *VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions) (VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse, error) { req, err := client.forceRecoveryServiceFabricPlatformUpdateDomainWalkCreateRequest(ctx, resourceGroupName, vmScaleSetName, platformUpdateDomain, options) if err != nil { - return RecoveryWalkResponseResponse{}, err + return VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RecoveryWalkResponseResponse{}, err + return VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return RecoveryWalkResponseResponse{}, client.forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, client.forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleError(resp) } return client.forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleResponse(resp) } // forceRecoveryServiceFabricPlatformUpdateDomainWalkCreateRequest creates the ForceRecoveryServiceFabricPlatformUpdateDomainWalk request. -func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformUpdateDomainWalkCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, platformUpdateDomain int32, options *VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformUpdateDomainWalkCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, platformUpdateDomain int32, options *VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -546,59 +433,58 @@ func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformU return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") reqQP.Set("platformUpdateDomain", strconv.FormatInt(int64(platformUpdateDomain), 10)) - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleResponse handles the ForceRecoveryServiceFabricPlatformUpdateDomainWalk response. -func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleResponse(resp *azcore.Response) (RecoveryWalkResponseResponse, error) { - var val *RecoveryWalkResponse - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RecoveryWalkResponseResponse{}, err +func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleResponse(resp *http.Response) (VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse, error) { + result := VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryWalkResponse); err != nil { + return VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err } - return RecoveryWalkResponseResponse{RawResponse: resp.Response, RecoveryWalkResponse: val}, nil + return result, nil } // forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleError handles the ForceRecoveryServiceFabricPlatformUpdateDomainWalk error response. -func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Display information about a virtual machine scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetOptions) (VirtualMachineScaleSetResponse, error) { +func (client *VirtualMachineScaleSetsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetOptions) (VirtualMachineScaleSetsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return VirtualMachineScaleSetResponse{}, err + return VirtualMachineScaleSetsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineScaleSetResponse{}, err + return VirtualMachineScaleSetsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineScaleSetResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachineScaleSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -612,61 +498,60 @@ func (client *VirtualMachineScaleSetsClient) getCreateRequest(ctx context.Contex return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachineScaleSetsClient) getHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetResponse, error) { - var val *VirtualMachineScaleSet - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetResponse{}, err +func (client *VirtualMachineScaleSetsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetsGetResponse, error) { + result := VirtualMachineScaleSetsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSet); err != nil { + return VirtualMachineScaleSetsGetResponse{}, err } - return VirtualMachineScaleSetResponse{RawResponse: resp.Response, VirtualMachineScaleSet: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachineScaleSetsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // GetInstanceView - Gets the status of a VM scale set instance. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) GetInstanceView(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetInstanceViewOptions) (VirtualMachineScaleSetInstanceViewResponse, error) { +func (client *VirtualMachineScaleSetsClient) GetInstanceView(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetInstanceViewOptions) (VirtualMachineScaleSetsGetInstanceViewResponse, error) { req, err := client.getInstanceViewCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return VirtualMachineScaleSetInstanceViewResponse{}, err + return VirtualMachineScaleSetsGetInstanceViewResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineScaleSetInstanceViewResponse{}, err + return VirtualMachineScaleSetsGetInstanceViewResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineScaleSetInstanceViewResponse{}, client.getInstanceViewHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetsGetInstanceViewResponse{}, client.getInstanceViewHandleError(resp) } return client.getInstanceViewHandleResponse(resp) } // getInstanceViewCreateRequest creates the GetInstanceView request. -func (client *VirtualMachineScaleSetsClient) getInstanceViewCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetInstanceViewOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) getInstanceViewCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetInstanceViewOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -680,58 +565,54 @@ func (client *VirtualMachineScaleSetsClient) getInstanceViewCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getInstanceViewHandleResponse handles the GetInstanceView response. -func (client *VirtualMachineScaleSetsClient) getInstanceViewHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetInstanceViewResponse, error) { - var val *VirtualMachineScaleSetInstanceView - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetInstanceViewResponse{}, err +func (client *VirtualMachineScaleSetsClient) getInstanceViewHandleResponse(resp *http.Response) (VirtualMachineScaleSetsGetInstanceViewResponse, error) { + result := VirtualMachineScaleSetsGetInstanceViewResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetInstanceView); err != nil { + return VirtualMachineScaleSetsGetInstanceViewResponse{}, err } - return VirtualMachineScaleSetInstanceViewResponse{RawResponse: resp.Response, VirtualMachineScaleSetInstanceView: val}, nil + return result, nil } // getInstanceViewHandleError handles the GetInstanceView error response. -func (client *VirtualMachineScaleSetsClient) getInstanceViewHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) getInstanceViewHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // GetOSUpgradeHistory - Gets list of OS upgrades on a VM scale set instance. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) GetOSUpgradeHistory(resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetOSUpgradeHistoryOptions) VirtualMachineScaleSetListOSUpgradeHistoryPager { - return &virtualMachineScaleSetListOSUpgradeHistoryPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) GetOSUpgradeHistory(resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetOSUpgradeHistoryOptions) *VirtualMachineScaleSetsGetOSUpgradeHistoryPager { + return &VirtualMachineScaleSetsGetOSUpgradeHistoryPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.getOSUpgradeHistoryCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) }, - responder: client.getOSUpgradeHistoryHandleResponse, - errorer: client.getOSUpgradeHistoryHandleError, - advancer: func(ctx context.Context, resp VirtualMachineScaleSetListOSUpgradeHistoryResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetListOSUpgradeHistory.NextLink) + advancer: func(ctx context.Context, resp VirtualMachineScaleSetsGetOSUpgradeHistoryResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetListOSUpgradeHistory.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // getOSUpgradeHistoryCreateRequest creates the GetOSUpgradeHistory request. -func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetOSUpgradeHistoryOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsGetOSUpgradeHistoryOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -745,58 +626,54 @@ func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryCreateRequest(ct return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getOSUpgradeHistoryHandleResponse handles the GetOSUpgradeHistory response. -func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetListOSUpgradeHistoryResponse, error) { - var val *VirtualMachineScaleSetListOSUpgradeHistory - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetListOSUpgradeHistoryResponse{}, err +func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryHandleResponse(resp *http.Response) (VirtualMachineScaleSetsGetOSUpgradeHistoryResponse, error) { + result := VirtualMachineScaleSetsGetOSUpgradeHistoryResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListOSUpgradeHistory); err != nil { + return VirtualMachineScaleSetsGetOSUpgradeHistoryResponse{}, err } - return VirtualMachineScaleSetListOSUpgradeHistoryResponse{RawResponse: resp.Response, VirtualMachineScaleSetListOSUpgradeHistory: val}, nil + return result, nil } // getOSUpgradeHistoryHandleError handles the GetOSUpgradeHistory error response. -func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - Gets a list of all VM scale sets under a resource group. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) List(resourceGroupName string, options *VirtualMachineScaleSetsListOptions) VirtualMachineScaleSetListResultPager { - return &virtualMachineScaleSetListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) List(resourceGroupName string, options *VirtualMachineScaleSetsListOptions) *VirtualMachineScaleSetsListPager { + return &VirtualMachineScaleSetsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, resourceGroupName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp VirtualMachineScaleSetListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetListResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachineScaleSetsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *VirtualMachineScaleSetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualMachineScaleSetsListOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualMachineScaleSetsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -806,117 +683,109 @@ func (client *VirtualMachineScaleSetsClient) listCreateRequest(ctx context.Conte return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachineScaleSetsClient) listHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetListResultResponse, error) { - var val *VirtualMachineScaleSetListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetListResultResponse{}, err +func (client *VirtualMachineScaleSetsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetsListResponse, error) { + result := VirtualMachineScaleSetsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListResult); err != nil { + return VirtualMachineScaleSetsListResponse{}, err } - return VirtualMachineScaleSetListResultResponse{RawResponse: resp.Response, VirtualMachineScaleSetListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachineScaleSetsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListAll - Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource group. Use 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. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) ListAll(options *VirtualMachineScaleSetsListAllOptions) VirtualMachineScaleSetListWithLinkResultPager { - return &virtualMachineScaleSetListWithLinkResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) ListAll(options *VirtualMachineScaleSetsListAllOptions) *VirtualMachineScaleSetsListAllPager { + return &VirtualMachineScaleSetsListAllPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listAllCreateRequest(ctx, options) }, - responder: client.listAllHandleResponse, - errorer: client.listAllHandleError, - advancer: func(ctx context.Context, resp VirtualMachineScaleSetListWithLinkResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetListWithLinkResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachineScaleSetsListAllResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetListWithLinkResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listAllCreateRequest creates the ListAll request. -func (client *VirtualMachineScaleSetsClient) listAllCreateRequest(ctx context.Context, options *VirtualMachineScaleSetsListAllOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) listAllCreateRequest(ctx context.Context, options *VirtualMachineScaleSetsListAllOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listAllHandleResponse handles the ListAll response. -func (client *VirtualMachineScaleSetsClient) listAllHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetListWithLinkResultResponse, error) { - var val *VirtualMachineScaleSetListWithLinkResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetListWithLinkResultResponse{}, err +func (client *VirtualMachineScaleSetsClient) listAllHandleResponse(resp *http.Response) (VirtualMachineScaleSetsListAllResponse, error) { + result := VirtualMachineScaleSetsListAllResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListWithLinkResult); err != nil { + return VirtualMachineScaleSetsListAllResponse{}, err } - return VirtualMachineScaleSetListWithLinkResultResponse{RawResponse: resp.Response, VirtualMachineScaleSetListWithLinkResult: val}, nil + return result, nil } // listAllHandleError handles the ListAll error response. -func (client *VirtualMachineScaleSetsClient) listAllHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) listAllHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // ListByLocation - Gets all the VM scale sets under the specified subscription for the specified location. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetsClient) ListByLocation(location string, options *VirtualMachineScaleSetsListByLocationOptions) VirtualMachineScaleSetListResultPager { - return &virtualMachineScaleSetListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) ListByLocation(location string, options *VirtualMachineScaleSetsListByLocationOptions) *VirtualMachineScaleSetsListByLocationPager { + return &VirtualMachineScaleSetsListByLocationPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listByLocationCreateRequest(ctx, location, options) }, - responder: client.listByLocationHandleResponse, - errorer: client.listByLocationHandleError, - advancer: func(ctx context.Context, resp VirtualMachineScaleSetListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetListResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachineScaleSetsListByLocationResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listByLocationCreateRequest creates the ListByLocation request. -func (client *VirtualMachineScaleSetsClient) listByLocationCreateRequest(ctx context.Context, location string, options *VirtualMachineScaleSetsListByLocationOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) listByLocationCreateRequest(ctx context.Context, location string, options *VirtualMachineScaleSetsListByLocationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -926,59 +795,55 @@ func (client *VirtualMachineScaleSetsClient) listByLocationCreateRequest(ctx con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listByLocationHandleResponse handles the ListByLocation response. -func (client *VirtualMachineScaleSetsClient) listByLocationHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetListResultResponse, error) { - var val *VirtualMachineScaleSetListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetListResultResponse{}, err +func (client *VirtualMachineScaleSetsClient) listByLocationHandleResponse(resp *http.Response) (VirtualMachineScaleSetsListByLocationResponse, error) { + result := VirtualMachineScaleSetsListByLocationResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListResult); err != nil { + return VirtualMachineScaleSetsListByLocationResponse{}, err } - return VirtualMachineScaleSetListResultResponse{RawResponse: resp.Response, VirtualMachineScaleSetListResult: val}, nil + return result, nil } // listByLocationHandleError handles the ListByLocation error response. -func (client *VirtualMachineScaleSetsClient) listByLocationHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) listByLocationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // ListSKUs - Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) ListSKUs(resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsListSKUsOptions) VirtualMachineScaleSetListSKUsResultPager { - return &virtualMachineScaleSetListSKUsResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) ListSKUs(resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsListSKUsOptions) *VirtualMachineScaleSetsListSKUsPager { + return &VirtualMachineScaleSetsListSKUsPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listSKUsCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) }, - responder: client.listSKUsHandleResponse, - errorer: client.listSKUsHandleError, - advancer: func(ctx context.Context, resp VirtualMachineScaleSetListSKUsResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetListSKUsResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachineScaleSetsListSKUsResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetListSKUsResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listSKUsCreateRequest creates the ListSKUs request. -func (client *VirtualMachineScaleSetsClient) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsListSKUsOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) listSKUsCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsListSKUsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -992,86 +857,57 @@ func (client *VirtualMachineScaleSetsClient) listSKUsCreateRequest(ctx context.C return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listSKUsHandleResponse handles the ListSKUs response. -func (client *VirtualMachineScaleSetsClient) listSKUsHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetListSKUsResultResponse, error) { - var val *VirtualMachineScaleSetListSKUsResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetListSKUsResultResponse{}, err +func (client *VirtualMachineScaleSetsClient) listSKUsHandleResponse(resp *http.Response) (VirtualMachineScaleSetsListSKUsResponse, error) { + result := VirtualMachineScaleSetsListSKUsResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListSKUsResult); err != nil { + return VirtualMachineScaleSetsListSKUsResponse{}, err } - return VirtualMachineScaleSetListSKUsResultResponse{RawResponse: resp.Response, VirtualMachineScaleSetListSKUsResult: val}, nil + return result, nil } // listSKUsHandleError handles the ListSKUs error response. -func (client *VirtualMachineScaleSetsClient) listSKUsHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) listSKUsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginPerformMaintenance - Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances which are not eligible for perform // maintenance will be failed. Please refer to best practices for more // details: https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginPerformMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPerformMaintenanceOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginPerformMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPerformMaintenanceOptions) (VirtualMachineScaleSetsPerformMaintenancePollerResponse, error) { resp, err := client.performMaintenance(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.PerformMaintenance", "", resp, client.con.Pipeline(), client.performMaintenanceHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return VirtualMachineScaleSetsPerformMaintenancePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsPerformMaintenancePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumePerformMaintenance creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumePerformMaintenance(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.PerformMaintenance", token, client.con.Pipeline(), client.performMaintenanceHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.PerformMaintenance", "", resp, client.pl, client.performMaintenanceHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsPerformMaintenancePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsPerformMaintenancePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } @@ -1079,23 +915,23 @@ func (client *VirtualMachineScaleSetsClient) ResumePerformMaintenance(ctx contex // maintenance will be failed. Please refer to best practices for more // details: https://docs.microsoft.com/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-maintenance-notifications // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPerformMaintenanceOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPerformMaintenanceOptions) (*http.Response, error) { req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.performMaintenanceHandleError(resp) } return resp, nil } // performMaintenanceCreateRequest creates the PerformMaintenance request. -func (client *VirtualMachineScaleSetsClient) performMaintenanceCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPerformMaintenanceOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) performMaintenanceCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPerformMaintenanceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1109,79 +945,50 @@ func (client *VirtualMachineScaleSetsClient) performMaintenanceCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.VMInstanceIDs != nil { - return req, req.MarshalAsJSON(*options.VMInstanceIDs) + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) } return req, nil } // performMaintenanceHandleError handles the PerformMaintenance error response. -func (client *VirtualMachineScaleSetsClient) performMaintenanceHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) performMaintenanceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginPowerOff - Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for // the resources. Instead, use deallocate to release resources and // avoid charges. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginPowerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPowerOffOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginPowerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPowerOffOptions) (VirtualMachineScaleSetsPowerOffPollerResponse, error) { resp, err := client.powerOff(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + return VirtualMachineScaleSetsPowerOffPollerResponse{}, err } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.PowerOff", "", resp, client.con.Pipeline(), client.powerOffHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsPowerOffPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumePowerOff creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumePowerOff(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.PowerOff", token, client.con.Pipeline(), client.powerOffHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.PowerOff", "", resp, client.pl, client.powerOffHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsPowerOffPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsPowerOffPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } @@ -1189,23 +996,23 @@ func (client *VirtualMachineScaleSetsClient) ResumePowerOff(ctx context.Context, // resources. Instead, use deallocate to release resources and // avoid charges. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPowerOffOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPowerOffOptions) (*http.Response, error) { req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.powerOffHandleError(resp) } return resp, nil } // powerOffCreateRequest creates the PowerOff request. -func (client *VirtualMachineScaleSetsClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPowerOffOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginPowerOffOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1219,102 +1026,73 @@ func (client *VirtualMachineScaleSetsClient) powerOffCreateRequest(ctx context.C return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.SkipShutdown != nil { reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.VMInstanceIDs != nil { - return req, req.MarshalAsJSON(*options.VMInstanceIDs) + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) } return req, nil } // powerOffHandleError handles the PowerOff error response. -func (client *VirtualMachineScaleSetsClient) powerOffHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) powerOffHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // 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 a generic error. -func (client *VirtualMachineScaleSetsClient) BeginRedeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRedeployOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginRedeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRedeployOptions) (VirtualMachineScaleSetsRedeployPollerResponse, error) { resp, err := client.redeploy(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsRedeployPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetsRedeployPollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.Redeploy", "", resp, client.con.Pipeline(), client.redeployHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.Redeploy", "", resp, client.pl, client.redeployHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsRedeployPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsRedeployPoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeRedeploy creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeRedeploy(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.Redeploy", token, client.con.Pipeline(), client.redeployHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Redeploy - 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 a generic error. -func (client *VirtualMachineScaleSetsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRedeployOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.redeployHandleError(resp) } return resp, nil } // redeployCreateRequest creates the Redeploy request. -func (client *VirtualMachineScaleSetsClient) redeployCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRedeployOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) redeployCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRedeployOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1328,79 +1106,50 @@ func (client *VirtualMachineScaleSetsClient) redeployCreateRequest(ctx context.C return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.VMInstanceIDs != nil { - return req, req.MarshalAsJSON(*options.VMInstanceIDs) + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) } return req, nil } // redeployHandleError handles the Redeploy error response. -func (client *VirtualMachineScaleSetsClient) redeployHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) redeployHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginReimage - Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which don't have a ephemeral OS disk, for virtual // machines who have a ephemeral OS disk the virtual machine is // reset to initial state. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginReimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginReimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageOptions) (VirtualMachineScaleSetsReimagePollerResponse, error) { resp, err := client.reimage(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + return VirtualMachineScaleSetsReimagePollerResponse{}, err } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.Reimage", "", resp, client.con.Pipeline(), client.reimageHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsReimagePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeReimage creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeReimage(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.Reimage", token, client.con.Pipeline(), client.reimageHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.Reimage", "", resp, client.pl, client.reimageHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsReimagePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsReimagePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } @@ -1408,23 +1157,23 @@ func (client *VirtualMachineScaleSetsClient) ResumeReimage(ctx context.Context, // who have a ephemeral OS disk the virtual machine is // reset to initial state. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.reimageHandleError(resp) } return resp, nil } // reimageCreateRequest creates the Reimage request. -func (client *VirtualMachineScaleSetsClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1438,101 +1187,72 @@ func (client *VirtualMachineScaleSetsClient) reimageCreateRequest(ctx context.Co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.VMScaleSetReimageInput != nil { - return req, req.MarshalAsJSON(*options.VMScaleSetReimageInput) + return req, runtime.MarshalAsJSON(req, *options.VMScaleSetReimageInput) } return req, nil } // reimageHandleError handles the Reimage error response. -func (client *VirtualMachineScaleSetsClient) reimageHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) reimageHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginReimageAll - Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed // disks. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginReimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageAllOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginReimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageAllOptions) (VirtualMachineScaleSetsReimageAllPollerResponse, error) { resp, err := client.reimageAll(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + return VirtualMachineScaleSetsReimageAllPollerResponse{}, err } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.ReimageAll", "", resp, client.con.Pipeline(), client.reimageAllHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsReimageAllPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeReimageAll creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeReimageAll(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.ReimageAll", token, client.con.Pipeline(), client.reimageAllHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.ReimageAll", "", resp, client.pl, client.reimageAllHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsReimageAllPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsReimageAllPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // ReimageAll - Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This operation is only supported for managed // disks. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageAllOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageAllOptions) (*http.Response, error) { req, err := client.reimageAllCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.reimageAllHandleError(resp) } return resp, nil } // reimageAllCreateRequest creates the ReimageAll request. -func (client *VirtualMachineScaleSetsClient) reimageAllCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageAllOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) reimageAllCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginReimageAllOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1546,99 +1266,70 @@ func (client *VirtualMachineScaleSetsClient) reimageAllCreateRequest(ctx context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.VMInstanceIDs != nil { - return req, req.MarshalAsJSON(*options.VMInstanceIDs) + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) } return req, nil } // reimageAllHandleError handles the ReimageAll error response. -func (client *VirtualMachineScaleSetsClient) reimageAllHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) reimageAllHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginRestart - Restarts one or more virtual machines in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginRestart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRestartOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginRestart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRestartOptions) (VirtualMachineScaleSetsRestartPollerResponse, error) { resp, err := client.restart(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsRestartPollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.Restart", "", resp, client.con.Pipeline(), client.restartHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsRestartPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeRestart creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeRestart(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.Restart", token, client.con.Pipeline(), client.restartHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.Restart", "", resp, client.pl, client.restartHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsRestartPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsRestartPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Restart - Restarts one or more virtual machines in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRestartOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.restartHandleError(resp) } return resp, nil } // restartCreateRequest creates the Restart request. -func (client *VirtualMachineScaleSetsClient) restartCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRestartOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) restartCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginRestartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1652,99 +1343,70 @@ func (client *VirtualMachineScaleSetsClient) restartCreateRequest(ctx context.Co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.VMInstanceIDs != nil { - return req, req.MarshalAsJSON(*options.VMInstanceIDs) + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) } return req, nil } // restartHandleError handles the Restart error response. -func (client *VirtualMachineScaleSetsClient) restartHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) restartHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginSetOrchestrationServiceState - Changes ServiceState property for a given service // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginSetOrchestrationServiceState(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsBeginSetOrchestrationServiceStateOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginSetOrchestrationServiceState(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsBeginSetOrchestrationServiceStateOptions) (VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse, error) { resp, err := client.setOrchestrationServiceState(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.SetOrchestrationServiceState", "", resp, client.con.Pipeline(), client.setOrchestrationServiceStateHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeSetOrchestrationServiceState creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeSetOrchestrationServiceState(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.SetOrchestrationServiceState", token, client.con.Pipeline(), client.setOrchestrationServiceStateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.SetOrchestrationServiceState", "", resp, client.pl, client.setOrchestrationServiceStateHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsSetOrchestrationServiceStatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // SetOrchestrationServiceState - Changes ServiceState property for a given service // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceState(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsBeginSetOrchestrationServiceStateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceState(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsBeginSetOrchestrationServiceStateOptions) (*http.Response, error) { req, err := client.setOrchestrationServiceStateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.setOrchestrationServiceStateHandleError(resp) } return resp, nil } // setOrchestrationServiceStateCreateRequest creates the SetOrchestrationServiceState request. -func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsBeginSetOrchestrationServiceStateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters OrchestrationServiceStateInput, options *VirtualMachineScaleSetsBeginSetOrchestrationServiceStateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1758,96 +1420,67 @@ func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateCreateR return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, runtime.MarshalAsJSON(req, parameters) } // setOrchestrationServiceStateHandleError handles the SetOrchestrationServiceState error response. -func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) setOrchestrationServiceStateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginStart - Starts one or more virtual machines in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginStart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginStartOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginStart(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginStartOptions) (VirtualMachineScaleSetsStartPollerResponse, error) { resp, err := client.start(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.Start", "", resp, client.con.Pipeline(), client.startHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return VirtualMachineScaleSetsStartPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsStartPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeStart creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeStart(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.Start", token, client.con.Pipeline(), client.startHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.Start", "", resp, client.pl, client.startHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsStartPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsStartPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Start - Starts one or more virtual machines in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginStartOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, vmScaleSetName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.startHandleError(resp) } return resp, nil } // startCreateRequest creates the Start request. -func (client *VirtualMachineScaleSetsClient) startCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginStartOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) startCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, options *VirtualMachineScaleSetsBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1861,99 +1494,70 @@ func (client *VirtualMachineScaleSetsClient) startCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.VMInstanceIDs != nil { - return req, req.MarshalAsJSON(*options.VMInstanceIDs) + return req, runtime.MarshalAsJSON(req, *options.VMInstanceIDs) } return req, nil } // startHandleError handles the Start error response. -func (client *VirtualMachineScaleSetsClient) startHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) startHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginUpdate - Update a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsBeginUpdateOptions) (VirtualMachineScaleSetPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsBeginUpdateOptions) (VirtualMachineScaleSetsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { - return VirtualMachineScaleSetPollerResponse{}, err - } - result := VirtualMachineScaleSetPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return VirtualMachineScaleSetPollerResponse{}, err + return VirtualMachineScaleSetsUpdatePollerResponse{}, err } - poller := &virtualMachineScaleSetPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new VirtualMachineScaleSetPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineScaleSetPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeUpdate(ctx context.Context, token string) (VirtualMachineScaleSetPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return VirtualMachineScaleSetPollerResponse{}, err + return VirtualMachineScaleSetsUpdatePollerResponse{}, err } - poller := &virtualMachineScaleSetPoller{ + result.Poller = &VirtualMachineScaleSetsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineScaleSetPollerResponse{}, err - } - result := VirtualMachineScaleSetPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Update a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsBeginUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *VirtualMachineScaleSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsBeginUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters VirtualMachineScaleSetUpdate, options *VirtualMachineScaleSetsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1967,97 +1571,68 @@ func (client *VirtualMachineScaleSetsClient) updateCreateRequest(ctx context.Con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // updateHandleError handles the Update error response. -func (client *VirtualMachineScaleSetsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginUpdateInstances - Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) BeginUpdateInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginUpdateInstancesOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetsClient) BeginUpdateInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginUpdateInstancesOptions) (VirtualMachineScaleSetsUpdateInstancesPollerResponse, error) { resp, err := client.updateInstances(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + return VirtualMachineScaleSetsUpdateInstancesPollerResponse{}, err } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetsClient.UpdateInstances", "", resp, client.con.Pipeline(), client.updateInstancesHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetsUpdateInstancesPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdateInstances creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetsClient) ResumeUpdateInstances(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetsClient.UpdateInstances", token, client.con.Pipeline(), client.updateInstancesHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetsClient.UpdateInstances", "", resp, client.pl, client.updateInstancesHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetsUpdateInstancesPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetsUpdateInstancesPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // UpdateInstances - Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetsClient) updateInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginUpdateInstancesOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetsClient) updateInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginUpdateInstancesOptions) (*http.Response, error) { req, err := client.updateInstancesCreateRequest(ctx, resourceGroupName, vmScaleSetName, vmInstanceIDs, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.updateInstancesHandleError(resp) } return resp, nil } // updateInstancesCreateRequest creates the UpdateInstances request. -func (client *VirtualMachineScaleSetsClient) updateInstancesCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginUpdateInstancesOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetsClient) updateInstancesCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, options *VirtualMachineScaleSetsBeginUpdateInstancesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -2071,25 +1646,24 @@ func (client *VirtualMachineScaleSetsClient) updateInstancesCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - return req, req.MarshalAsJSON(vmInstanceIDs) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, runtime.MarshalAsJSON(req, vmInstanceIDs) } // updateInstancesHandleError handles the UpdateInstances error response. -func (client *VirtualMachineScaleSetsClient) updateInstancesHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetsClient) updateInstancesHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvmextensions_client.go b/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvmextensions_client.go index b3e9596e2390..a38b0aeed786 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvmextensions_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvmextensions_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineScaleSetVMExtensionsClient contains the methods for the VirtualMachineScaleSetVMExtensions group. // Don't use this type directly, use NewVirtualMachineScaleSetVMExtensionsClient() instead. type VirtualMachineScaleSetVMExtensionsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineScaleSetVMExtensionsClient creates a new instance of VirtualMachineScaleSetVMExtensionsClient with the specified values. -func NewVirtualMachineScaleSetVMExtensionsClient(con *armcore.Connection, subscriptionID string) *VirtualMachineScaleSetVMExtensionsClient { - return &VirtualMachineScaleSetVMExtensionsClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetVMExtensionsClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetVMExtensionsClient { + return &VirtualMachineScaleSetVMExtensionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - The operation to create or update the VMSS VM extension. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsBeginCreateOrUpdateOptions) (VirtualMachineScaleSetVMExtensionPollerResponse, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsBeginCreateOrUpdateOptions) (VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) if err != nil { - return VirtualMachineScaleSetVMExtensionPollerResponse{}, err + return VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse{}, err } - result := VirtualMachineScaleSetVMExtensionPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMExtensionsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMExtensionsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return VirtualMachineScaleSetVMExtensionPollerResponse{}, err + return VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse{}, err } - poller := &virtualMachineScaleSetVMExtensionPoller{ + result.Poller = &VirtualMachineScaleSetVMExtensionsCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetVMExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new VirtualMachineScaleSetVMExtensionPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineScaleSetVMExtensionPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMExtensionsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (VirtualMachineScaleSetVMExtensionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMExtensionsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return VirtualMachineScaleSetVMExtensionPollerResponse{}, err - } - poller := &virtualMachineScaleSetVMExtensionPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineScaleSetVMExtensionPollerResponse{}, err - } - result := VirtualMachineScaleSetVMExtensionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetVMExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - The operation to create or update the VMSS VM extension. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtension, options *VirtualMachineScaleSetVMExtensionsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -119,98 +95,69 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateCreateRequ return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(extensionParameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, extensionParameters) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMExtensionsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - The operation to delete the VMSS VM extension. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsBeginDeleteOptions) (VirtualMachineScaleSetVMExtensionsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMExtensionsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetVMExtensionsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMExtensionsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMExtensionsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMExtensionsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMExtensionsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMExtensionsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMExtensionsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - The operation to delete the VMSS VM extension. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsBeginDeleteOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *VirtualMachineScaleSetVMExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsBeginDeleteOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -232,50 +179,49 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) deleteCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *VirtualMachineScaleSetVMExtensionsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMExtensionsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - The operation to get the VMSS VM extension. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMExtensionsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsGetOptions) (VirtualMachineScaleSetVMExtensionResponse, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsGetOptions) (VirtualMachineScaleSetVMExtensionsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, options) if err != nil { - return VirtualMachineScaleSetVMExtensionResponse{}, err + return VirtualMachineScaleSetVMExtensionsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineScaleSetVMExtensionResponse{}, err + return VirtualMachineScaleSetVMExtensionsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineScaleSetVMExtensionResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMExtensionsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachineScaleSetVMExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsGetOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, options *VirtualMachineScaleSetVMExtensionsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -297,62 +243,61 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) getCreateRequest(ctx con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachineScaleSetVMExtensionsClient) getHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetVMExtensionResponse, error) { - var val *VirtualMachineScaleSetVMExtension - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetVMExtensionResponse{}, err +func (client *VirtualMachineScaleSetVMExtensionsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMExtensionsGetResponse, error) { + result := VirtualMachineScaleSetVMExtensionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMExtension); err != nil { + return VirtualMachineScaleSetVMExtensionsGetResponse{}, err } - return VirtualMachineScaleSetVMExtensionResponse{RawResponse: resp.Response, VirtualMachineScaleSetVMExtension: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachineScaleSetVMExtensionsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMExtensionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - The operation to get all extensions of an instance in Virtual Machine Scaleset. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMExtensionsClient) List(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMExtensionsListOptions) (VirtualMachineScaleSetVMExtensionsListResultResponse, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) List(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMExtensionsListOptions) (VirtualMachineScaleSetVMExtensionsListResponse, error) { req, err := client.listCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return VirtualMachineScaleSetVMExtensionsListResultResponse{}, err + return VirtualMachineScaleSetVMExtensionsListResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineScaleSetVMExtensionsListResultResponse{}, err + return VirtualMachineScaleSetVMExtensionsListResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineScaleSetVMExtensionsListResultResponse{}, client.listHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMExtensionsListResponse{}, client.listHandleError(resp) } return client.listHandleResponse(resp) } // listCreateRequest creates the List request. -func (client *VirtualMachineScaleSetVMExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMExtensionsListOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMExtensionsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -370,110 +315,81 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) listCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachineScaleSetVMExtensionsClient) listHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetVMExtensionsListResultResponse, error) { - var val *VirtualMachineScaleSetVMExtensionsListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetVMExtensionsListResultResponse{}, err +func (client *VirtualMachineScaleSetVMExtensionsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMExtensionsListResponse, error) { + result := VirtualMachineScaleSetVMExtensionsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMExtensionsListResult); err != nil { + return VirtualMachineScaleSetVMExtensionsListResponse{}, err } - return VirtualMachineScaleSetVMExtensionsListResultResponse{RawResponse: resp.Response, VirtualMachineScaleSetVMExtensionsListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachineScaleSetVMExtensionsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMExtensionsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - The operation to update the VMSS VM extension. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsBeginUpdateOptions) (VirtualMachineScaleSetVMExtensionPollerResponse, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsBeginUpdateOptions) (VirtualMachineScaleSetVMExtensionsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) if err != nil { - return VirtualMachineScaleSetVMExtensionPollerResponse{}, err - } - result := VirtualMachineScaleSetVMExtensionPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMExtensionsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return VirtualMachineScaleSetVMExtensionPollerResponse{}, err + return VirtualMachineScaleSetVMExtensionsUpdatePollerResponse{}, err } - poller := &virtualMachineScaleSetVMExtensionPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetVMExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetVMExtensionsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new VirtualMachineScaleSetVMExtensionPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineScaleSetVMExtensionPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMExtensionsClient) ResumeUpdate(ctx context.Context, token string) (VirtualMachineScaleSetVMExtensionPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMExtensionsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMExtensionsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return VirtualMachineScaleSetVMExtensionPollerResponse{}, err + return VirtualMachineScaleSetVMExtensionsUpdatePollerResponse{}, err } - poller := &virtualMachineScaleSetVMExtensionPoller{ + result.Poller = &VirtualMachineScaleSetVMExtensionsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineScaleSetVMExtensionPollerResponse{}, err - } - result := VirtualMachineScaleSetVMExtensionPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetVMExtensionResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - The operation to update the VMSS VM extension. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsBeginUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, vmExtensionName, extensionParameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *VirtualMachineScaleSetVMExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsBeginUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMExtensionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, vmExtensionName string, extensionParameters VirtualMachineScaleSetVMExtensionUpdate, options *VirtualMachineScaleSetVMExtensionsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -495,27 +411,26 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) updateCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(extensionParameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, extensionParameters) } // updateHandleError handles the Update error response. -func (client *VirtualMachineScaleSetVMExtensionsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMExtensionsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvmruncommands_client.go b/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvmruncommands_client.go index 4c8cf26d46a9..40a65690bdae 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvmruncommands_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvmruncommands_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,93 +12,68 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineScaleSetVMRunCommandsClient contains the methods for the VirtualMachineScaleSetVMRunCommands group. // Don't use this type directly, use NewVirtualMachineScaleSetVMRunCommandsClient() instead. type VirtualMachineScaleSetVMRunCommandsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineScaleSetVMRunCommandsClient creates a new instance of VirtualMachineScaleSetVMRunCommandsClient with the specified values. -func NewVirtualMachineScaleSetVMRunCommandsClient(con *armcore.Connection, subscriptionID string) *VirtualMachineScaleSetVMRunCommandsClient { - return &VirtualMachineScaleSetVMRunCommandsClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetVMRunCommandsClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetVMRunCommandsClient { + return &VirtualMachineScaleSetVMRunCommandsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginCreateOrUpdate - The operation to create or update the VMSS VM run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsBeginCreateOrUpdateOptions) (VirtualMachineRunCommandPollerResponse, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsBeginCreateOrUpdateOptions) (VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err + return VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse{}, err } - result := VirtualMachineRunCommandPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMRunCommandsClient.CreateOrUpdate", "", resp, client.con.Pipeline(), client.createOrUpdateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMRunCommandsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err + return VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse{}, err } - poller := &virtualMachineRunCommandPoller{ + result.Poller = &VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineRunCommandResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeCreateOrUpdate creates a new VirtualMachineRunCommandPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineRunCommandPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMRunCommandsClient) ResumeCreateOrUpdate(ctx context.Context, token string) (VirtualMachineRunCommandPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMRunCommandsClient.CreateOrUpdate", token, client.con.Pipeline(), client.createOrUpdateHandleError) - if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err - } - poller := &virtualMachineRunCommandPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err - } - result := VirtualMachineRunCommandPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineRunCommandResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // CreateOrUpdate - The operation to create or update the VMSS VM run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsBeginCreateOrUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusCreated) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return nil, client.createOrUpdateHandleError(resp) } return resp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsBeginCreateOrUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommand, options *VirtualMachineScaleSetVMRunCommandsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -119,98 +95,69 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateCreateReq return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") - return req, req.MarshalAsJSON(runCommand) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") + return req, runtime.MarshalAsJSON(req, runCommand) } // createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMRunCommandsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginDelete - The operation to delete the VMSS VM run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsBeginDeleteOptions) (VirtualMachineScaleSetVMRunCommandsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMRunCommandsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetVMRunCommandsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMRunCommandsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMRunCommandsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMRunCommandsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMRunCommandsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMRunCommandsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMRunCommandsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - The operation to delete the VMSS VM run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsBeginDeleteOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsBeginDeleteOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -232,50 +179,49 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMRunCommandsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // Get - The operation to get the VMSS VM run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMRunCommandsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsGetOptions) (VirtualMachineRunCommandResponse, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsGetOptions) (VirtualMachineScaleSetVMRunCommandsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, options) if err != nil { - return VirtualMachineRunCommandResponse{}, err + return VirtualMachineScaleSetVMRunCommandsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineRunCommandResponse{}, err + return VirtualMachineScaleSetVMRunCommandsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineRunCommandResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMRunCommandsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachineScaleSetVMRunCommandsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsGetOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, options *VirtualMachineScaleSetVMRunCommandsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -297,62 +243,58 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) getCreateRequest(ctx co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachineScaleSetVMRunCommandsClient) getHandleResponse(resp *azcore.Response) (VirtualMachineRunCommandResponse, error) { - var val *VirtualMachineRunCommand - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineRunCommandResponse{}, err +func (client *VirtualMachineScaleSetVMRunCommandsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMRunCommandsGetResponse, error) { + result := VirtualMachineScaleSetVMRunCommandsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommand); err != nil { + return VirtualMachineScaleSetVMRunCommandsGetResponse{}, err } - return VirtualMachineRunCommandResponse{RawResponse: resp.Response, VirtualMachineRunCommand: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachineScaleSetVMRunCommandsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMRunCommandsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // List - The operation to get all run commands of an instance in Virtual Machine Scaleset. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMRunCommandsClient) List(resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMRunCommandsListOptions) VirtualMachineRunCommandsListResultPager { - return &virtualMachineRunCommandsListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) List(resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMRunCommandsListOptions) *VirtualMachineScaleSetVMRunCommandsListPager { + return &VirtualMachineScaleSetVMRunCommandsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp VirtualMachineRunCommandsListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineRunCommandsListResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachineScaleSetVMRunCommandsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineRunCommandsListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *VirtualMachineScaleSetVMRunCommandsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMRunCommandsListOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMRunCommandsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -370,110 +312,81 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) listCreateRequest(ctx c return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachineScaleSetVMRunCommandsClient) listHandleResponse(resp *azcore.Response) (VirtualMachineRunCommandsListResultResponse, error) { - var val *VirtualMachineRunCommandsListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineRunCommandsListResultResponse{}, err +func (client *VirtualMachineScaleSetVMRunCommandsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMRunCommandsListResponse, error) { + result := VirtualMachineScaleSetVMRunCommandsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommandsListResult); err != nil { + return VirtualMachineScaleSetVMRunCommandsListResponse{}, err } - return VirtualMachineRunCommandsListResultResponse{RawResponse: resp.Response, VirtualMachineRunCommandsListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachineScaleSetVMRunCommandsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMRunCommandsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginUpdate - The operation to update the VMSS VM run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsBeginUpdateOptions) (VirtualMachineRunCommandPollerResponse, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsBeginUpdateOptions) (VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err - } - result := VirtualMachineRunCommandPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMRunCommandsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err + return VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse{}, err } - poller := &virtualMachineRunCommandPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineRunCommandResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new VirtualMachineRunCommandPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineRunCommandPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMRunCommandsClient) ResumeUpdate(ctx context.Context, token string) (VirtualMachineRunCommandPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMRunCommandsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMRunCommandsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err + return VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse{}, err } - poller := &virtualMachineRunCommandPoller{ + result.Poller = &VirtualMachineScaleSetVMRunCommandsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineRunCommandPollerResponse{}, err - } - result := VirtualMachineRunCommandPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineRunCommandResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - The operation to update the VMSS VM run command. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsBeginUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, runCommandName, runCommand, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *VirtualMachineScaleSetVMRunCommandsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsBeginUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMRunCommandsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, runCommandName string, runCommand VirtualMachineRunCommandUpdate, options *VirtualMachineScaleSetVMRunCommandsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -495,27 +408,26 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) updateCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPatch, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") - return req, req.MarshalAsJSON(runCommand) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") + return req, runtime.MarshalAsJSON(req, runCommand) } // updateHandleError handles the Update error response. -func (client *VirtualMachineScaleSetVMRunCommandsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMRunCommandsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvms_client.go b/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvms_client.go index fecc76e50e09..9c43b9241f22 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvms_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachinescalesetvms_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -11,74 +12,49 @@ import ( "context" "errors" "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strconv" "strings" - "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineScaleSetVMsClient contains the methods for the VirtualMachineScaleSetVMs group. // Don't use this type directly, use NewVirtualMachineScaleSetVMsClient() instead. type VirtualMachineScaleSetVMsClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineScaleSetVMsClient creates a new instance of VirtualMachineScaleSetVMsClient with the specified values. -func NewVirtualMachineScaleSetVMsClient(con *armcore.Connection, subscriptionID string) *VirtualMachineScaleSetVMsClient { - return &VirtualMachineScaleSetVMsClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetVMsClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetVMsClient { + return &VirtualMachineScaleSetVMsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // BeginDeallocate - Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute resources it uses. // You are not billed for the compute resources of this virtual // machine once it is deallocated. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginDeallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeallocateOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginDeallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeallocateOptions) (VirtualMachineScaleSetVMsDeallocatePollerResponse, error) { resp, err := client.deallocate(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsDeallocatePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetVMsDeallocatePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.Deallocate", "", resp, client.con.Pipeline(), client.deallocateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.Deallocate", "", resp, client.pl, client.deallocateHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsDeallocatePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMsDeallocatePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDeallocate creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumeDeallocate(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Deallocate", token, client.con.Pipeline(), client.deallocateHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } @@ -86,23 +62,23 @@ func (client *VirtualMachineScaleSetVMsClient) ResumeDeallocate(ctx context.Cont // are not billed for the compute resources of this virtual // machine once it is deallocated. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeallocateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) deallocate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeallocateOptions) (*http.Response, error) { req, err := client.deallocateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.deallocateHandleError(resp) } return resp, nil } // deallocateCreateRequest creates the Deallocate request. -func (client *VirtualMachineScaleSetVMsClient) deallocateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeallocateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) deallocateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeallocateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -120,96 +96,67 @@ func (client *VirtualMachineScaleSetVMsClient) deallocateCreateRequest(ctx conte return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deallocateHandleError handles the Deallocate error response. -func (client *VirtualMachineScaleSetVMsClient) deallocateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) deallocateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginDelete - Deletes a virtual machine from a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeleteOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginDelete(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeleteOptions) (VirtualMachineScaleSetVMsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsDeletePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetVMsDeletePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.Delete", "", resp, client.con.Pipeline(), client.deleteHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsDeletePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMsDeletePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeDelete creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumeDelete(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Delete", token, client.con.Pipeline(), client.deleteHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Delete - Deletes a virtual machine from a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeleteOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) deleteOperation(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { return nil, client.deleteHandleError(resp) } return resp, nil } // deleteCreateRequest creates the Delete request. -func (client *VirtualMachineScaleSetVMsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeleteOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -227,51 +174,50 @@ func (client *VirtualMachineScaleSetVMsClient) deleteCreateRequest(ctx context.C return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodDelete, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.ForceDeletion != nil { reqQP.Set("forceDeletion", strconv.FormatBool(*options.ForceDeletion)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // deleteHandleError handles the Delete error response. -func (client *VirtualMachineScaleSetVMsClient) deleteHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // Get - Gets a virtual machine from a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsGetOptions) (VirtualMachineScaleSetVMResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsGetOptions) (VirtualMachineScaleSetVMsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return VirtualMachineScaleSetVMResponse{}, err + return VirtualMachineScaleSetVMsGetResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineScaleSetVMResponse{}, err + return VirtualMachineScaleSetVMsGetResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineScaleSetVMResponse{}, client.getHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMsGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *VirtualMachineScaleSetVMsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsGetOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -289,61 +235,60 @@ func (client *VirtualMachineScaleSetVMsClient) getCreateRequest(ctx context.Cont return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *VirtualMachineScaleSetVMsClient) getHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetVMResponse, error) { - var val *VirtualMachineScaleSetVM - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetVMResponse{}, err +func (client *VirtualMachineScaleSetVMsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsGetResponse, error) { + result := VirtualMachineScaleSetVMsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVM); err != nil { + return VirtualMachineScaleSetVMsGetResponse{}, err } - return VirtualMachineScaleSetVMResponse{RawResponse: resp.Response, VirtualMachineScaleSetVM: val}, nil + return result, nil } // getHandleError handles the Get error response. -func (client *VirtualMachineScaleSetVMsClient) getHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // GetInstanceView - Gets the status of a virtual machine from a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) GetInstanceView(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsGetInstanceViewOptions) (VirtualMachineScaleSetVMInstanceViewResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) GetInstanceView(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsGetInstanceViewOptions) (VirtualMachineScaleSetVMsGetInstanceViewResponse, error) { req, err := client.getInstanceViewCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return VirtualMachineScaleSetVMInstanceViewResponse{}, err + return VirtualMachineScaleSetVMsGetInstanceViewResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineScaleSetVMInstanceViewResponse{}, err + return VirtualMachineScaleSetVMsGetInstanceViewResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineScaleSetVMInstanceViewResponse{}, client.getInstanceViewHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMsGetInstanceViewResponse{}, client.getInstanceViewHandleError(resp) } return client.getInstanceViewHandleResponse(resp) } // getInstanceViewCreateRequest creates the GetInstanceView request. -func (client *VirtualMachineScaleSetVMsClient) getInstanceViewCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsGetInstanceViewOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) getInstanceViewCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsGetInstanceViewOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -361,58 +306,54 @@ func (client *VirtualMachineScaleSetVMsClient) getInstanceViewCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // getInstanceViewHandleResponse handles the GetInstanceView response. -func (client *VirtualMachineScaleSetVMsClient) getInstanceViewHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetVMInstanceViewResponse, error) { - var val *VirtualMachineScaleSetVMInstanceView - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetVMInstanceViewResponse{}, err +func (client *VirtualMachineScaleSetVMsClient) getInstanceViewHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsGetInstanceViewResponse, error) { + result := VirtualMachineScaleSetVMsGetInstanceViewResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMInstanceView); err != nil { + return VirtualMachineScaleSetVMsGetInstanceViewResponse{}, err } - return VirtualMachineScaleSetVMInstanceViewResponse{RawResponse: resp.Response, VirtualMachineScaleSetVMInstanceView: val}, nil + return result, nil } // getInstanceViewHandleError handles the GetInstanceView error response. -func (client *VirtualMachineScaleSetVMsClient) getInstanceViewHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) getInstanceViewHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // List - Gets a list of all virtual machines in a VM scale sets. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) List(resourceGroupName string, virtualMachineScaleSetName string, options *VirtualMachineScaleSetVMsListOptions) VirtualMachineScaleSetVMListResultPager { - return &virtualMachineScaleSetVMListResultPager{ - pipeline: client.con.Pipeline(), - requester: func(ctx context.Context) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) List(resourceGroupName string, virtualMachineScaleSetName string, options *VirtualMachineScaleSetVMsListOptions) *VirtualMachineScaleSetVMsListPager { + return &VirtualMachineScaleSetVMsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { return client.listCreateRequest(ctx, resourceGroupName, virtualMachineScaleSetName, options) }, - responder: client.listHandleResponse, - errorer: client.listHandleError, - advancer: func(ctx context.Context, resp VirtualMachineScaleSetVMListResultResponse) (*azcore.Request, error) { - return azcore.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetVMListResult.NextLink) + advancer: func(ctx context.Context, resp VirtualMachineScaleSetVMsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.VirtualMachineScaleSetVMListResult.NextLink) }, - statusCodes: []int{http.StatusOK}, } } // listCreateRequest creates the List request. -func (client *VirtualMachineScaleSetVMsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, options *VirtualMachineScaleSetVMsListOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, options *VirtualMachineScaleSetVMsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -426,12 +367,11 @@ func (client *VirtualMachineScaleSetVMsClient) listCreateRequest(ctx context.Con return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -441,100 +381,72 @@ func (client *VirtualMachineScaleSetVMsClient) listCreateRequest(ctx context.Con if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachineScaleSetVMsClient) listHandleResponse(resp *azcore.Response) (VirtualMachineScaleSetVMListResultResponse, error) { - var val *VirtualMachineScaleSetVMListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineScaleSetVMListResultResponse{}, err +func (client *VirtualMachineScaleSetVMsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsListResponse, error) { + result := VirtualMachineScaleSetVMsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMListResult); err != nil { + return VirtualMachineScaleSetVMsListResponse{}, err } - return VirtualMachineScaleSetVMListResultResponse{RawResponse: resp.Response, VirtualMachineScaleSetVMListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachineScaleSetVMsClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginPerformMaintenance - Performs maintenance on a virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginPerformMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPerformMaintenanceOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginPerformMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPerformMaintenanceOptions) (VirtualMachineScaleSetVMsPerformMaintenancePollerResponse, error) { resp, err := client.performMaintenance(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsPerformMaintenancePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetVMsPerformMaintenancePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.PerformMaintenance", "", resp, client.con.Pipeline(), client.performMaintenanceHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.PerformMaintenance", "", resp, client.pl, client.performMaintenanceHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsPerformMaintenancePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMsPerformMaintenancePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumePerformMaintenance creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumePerformMaintenance(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.PerformMaintenance", token, client.con.Pipeline(), client.performMaintenanceHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // PerformMaintenance - Performs maintenance on a virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPerformMaintenanceOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) performMaintenance(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPerformMaintenanceOptions) (*http.Response, error) { req, err := client.performMaintenanceCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.performMaintenanceHandleError(resp) } return resp, nil } // performMaintenanceCreateRequest creates the PerformMaintenance request. -func (client *VirtualMachineScaleSetVMsClient) performMaintenanceCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPerformMaintenanceOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) performMaintenanceCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPerformMaintenanceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -552,76 +464,47 @@ func (client *VirtualMachineScaleSetVMsClient) performMaintenanceCreateRequest(c return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // performMaintenanceHandleError handles the PerformMaintenance error response. -func (client *VirtualMachineScaleSetVMsClient) performMaintenanceHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) performMaintenanceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginPowerOff - Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached and you are getting charged for the resources. // Instead, use deallocate to release resources and avoid // charges. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginPowerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPowerOffOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginPowerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPowerOffOptions) (VirtualMachineScaleSetVMsPowerOffPollerResponse, error) { resp, err := client.powerOff(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.PowerOff", "", resp, client.con.Pipeline(), client.powerOffHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return VirtualMachineScaleSetVMsPowerOffPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetVMsPowerOffPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumePowerOff creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumePowerOff(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.PowerOff", token, client.con.Pipeline(), client.powerOffHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.PowerOff", "", resp, client.pl, client.powerOffHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsPowerOffPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMsPowerOffPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } @@ -629,23 +512,23 @@ func (client *VirtualMachineScaleSetVMsClient) ResumePowerOff(ctx context.Contex // Instead, use deallocate to release resources and avoid // charges. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPowerOffOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) powerOff(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPowerOffOptions) (*http.Response, error) { req, err := client.powerOffCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.powerOffHandleError(resp) } return resp, nil } // powerOffCreateRequest creates the PowerOff request. -func (client *VirtualMachineScaleSetVMsClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPowerOffOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) powerOffCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginPowerOffOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -663,99 +546,70 @@ func (client *VirtualMachineScaleSetVMsClient) powerOffCreateRequest(ctx context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.SkipShutdown != nil { reqQP.Set("skipShutdown", strconv.FormatBool(*options.SkipShutdown)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // powerOffHandleError handles the PowerOff error response. -func (client *VirtualMachineScaleSetVMsClient) powerOffHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) powerOffHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginRedeploy - Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginRedeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRedeployOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginRedeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRedeployOptions) (VirtualMachineScaleSetVMsRedeployPollerResponse, error) { resp, err := client.redeploy(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.Redeploy", "", resp, client.con.Pipeline(), client.redeployHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsRedeployPollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetVMsRedeployPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeRedeploy creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumeRedeploy(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Redeploy", token, client.con.Pipeline(), client.redeployHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.Redeploy", "", resp, client.pl, client.redeployHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsRedeployPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMsRedeployPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Redeploy - Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and powers it back on. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRedeployOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) redeploy(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRedeployOptions) (*http.Response, error) { req, err := client.redeployCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.redeployHandleError(resp) } return resp, nil } // redeployCreateRequest creates the Redeploy request. -func (client *VirtualMachineScaleSetVMsClient) redeployCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRedeployOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) redeployCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRedeployOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -773,96 +627,67 @@ func (client *VirtualMachineScaleSetVMsClient) redeployCreateRequest(ctx context return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // redeployHandleError handles the Redeploy error response. -func (client *VirtualMachineScaleSetVMsClient) redeployHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) redeployHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginReimage - Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginReimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginReimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageOptions) (VirtualMachineScaleSetVMsReimagePollerResponse, error) { resp, err := client.reimage(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsReimagePollerResponse{}, err } - result := HTTPPollerResponse{ - RawResponse: resp.Response, + result := VirtualMachineScaleSetVMsReimagePollerResponse{ + RawResponse: resp, } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.Reimage", "", resp, client.con.Pipeline(), client.reimageHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.Reimage", "", resp, client.pl, client.reimageHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsReimagePollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMsReimagePoller{ pt: pt, } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } - return result, nil -} - -// ResumeReimage creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumeReimage(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Reimage", token, client.con.Pipeline(), client.reimageHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Reimage - Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) reimage(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageOptions) (*http.Response, error) { req, err := client.reimageCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.reimageHandleError(resp) } return resp, nil } // reimageCreateRequest creates the Reimage request. -func (client *VirtualMachineScaleSetVMsClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) reimageCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -880,101 +705,72 @@ func (client *VirtualMachineScaleSetVMsClient) reimageCreateRequest(ctx context. return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.VMScaleSetVMReimageInput != nil { - return req, req.MarshalAsJSON(*options.VMScaleSetVMReimageInput) + return req, runtime.MarshalAsJSON(req, *options.VMScaleSetVMReimageInput) } return req, nil } // reimageHandleError handles the Reimage error response. -func (client *VirtualMachineScaleSetVMsClient) reimageHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) reimageHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginReimageAll - Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is only supported for // managed disks. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginReimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageAllOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginReimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageAllOptions) (VirtualMachineScaleSetVMsReimageAllPollerResponse, error) { resp, err := client.reimageAll(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.ReimageAll", "", resp, client.con.Pipeline(), client.reimageAllHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsReimageAllPollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetVMsReimageAllPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeReimageAll creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumeReimageAll(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.ReimageAll", token, client.con.Pipeline(), client.reimageAllHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.ReimageAll", "", resp, client.pl, client.reimageAllHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsReimageAllPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMsReimageAllPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // ReimageAll - Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. This operation is only supported for managed // disks. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageAllOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) reimageAll(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageAllOptions) (*http.Response, error) { req, err := client.reimageAllCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.reimageAllHandleError(resp) } return resp, nil } // reimageAllCreateRequest creates the ReimageAll request. -func (client *VirtualMachineScaleSetVMsClient) reimageAllCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageAllOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) reimageAllCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginReimageAllOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -992,96 +788,67 @@ func (client *VirtualMachineScaleSetVMsClient) reimageAllCreateRequest(ctx conte return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // reimageAllHandleError handles the ReimageAll error response. -func (client *VirtualMachineScaleSetVMsClient) reimageAllHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) reimageAllHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginRestart - Restarts a virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginRestart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRestartOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginRestart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRestartOptions) (VirtualMachineScaleSetVMsRestartPollerResponse, error) { resp, err := client.restart(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.Restart", "", resp, client.con.Pipeline(), client.restartHandleError) - if err != nil { - return HTTPPollerResponse{}, err - } - poller := &httpPoller{ - pt: pt, + return VirtualMachineScaleSetVMsRestartPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetVMsRestartPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeRestart creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumeRestart(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Restart", token, client.con.Pipeline(), client.restartHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.Restart", "", resp, client.pl, client.restartHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsRestartPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMsRestartPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Restart - Restarts a virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRestartOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) restart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRestartOptions) (*http.Response, error) { req, err := client.restartCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.restartHandleError(resp) } return resp, nil } // restartCreateRequest creates the Restart request. -func (client *VirtualMachineScaleSetVMsClient) restartCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRestartOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) restartCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginRestartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1099,48 +866,47 @@ func (client *VirtualMachineScaleSetVMsClient) restartCreateRequest(ctx context. return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // restartHandleError handles the Restart error response. -func (client *VirtualMachineScaleSetVMsClient) restartHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) restartHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // RetrieveBootDiagnosticsData - The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale set. // If the operation fails it returns the *CloudError error type. -func (client *VirtualMachineScaleSetVMsClient) RetrieveBootDiagnosticsData(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataOptions) (RetrieveBootDiagnosticsDataResultResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) RetrieveBootDiagnosticsData(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataOptions) (VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse, error) { req, err := client.retrieveBootDiagnosticsDataCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return RetrieveBootDiagnosticsDataResultResponse{}, err + return VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return RetrieveBootDiagnosticsDataResultResponse{}, err + return VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return RetrieveBootDiagnosticsDataResultResponse{}, client.retrieveBootDiagnosticsDataHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse{}, client.retrieveBootDiagnosticsDataHandleError(resp) } return client.retrieveBootDiagnosticsDataHandleResponse(resp) } // retrieveBootDiagnosticsDataCreateRequest creates the RetrieveBootDiagnosticsData request. -func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1158,110 +924,81 @@ func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataCreate return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() + reqQP := req.Raw().URL.Query() if options != nil && options.SasURIExpirationTimeInMinutes != nil { reqQP.Set("sasUriExpirationTimeInMinutes", strconv.FormatInt(int64(*options.SasURIExpirationTimeInMinutes), 10)) } - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // retrieveBootDiagnosticsDataHandleResponse handles the RetrieveBootDiagnosticsData response. -func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataHandleResponse(resp *azcore.Response) (RetrieveBootDiagnosticsDataResultResponse, error) { - var val *RetrieveBootDiagnosticsDataResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return RetrieveBootDiagnosticsDataResultResponse{}, err +func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse, error) { + result := VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RetrieveBootDiagnosticsDataResult); err != nil { + return VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse{}, err } - return RetrieveBootDiagnosticsDataResultResponse{RawResponse: resp.Response, RetrieveBootDiagnosticsDataResult: val}, nil + return result, nil } // retrieveBootDiagnosticsDataHandleError handles the RetrieveBootDiagnosticsData error response. -func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } errType := CloudError{raw: string(body)} - if err := resp.UnmarshalAsJSON(&errType); err != nil { - return azcore.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp.Response) + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) } - return azcore.NewResponseError(&errType, resp.Response) + return runtime.NewResponseError(&errType, resp) } // BeginRunCommand - Run command on a virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginRunCommand(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsBeginRunCommandOptions) (RunCommandResultPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginRunCommand(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsBeginRunCommandOptions) (VirtualMachineScaleSetVMsRunCommandPollerResponse, error) { resp, err := client.runCommand(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) if err != nil { - return RunCommandResultPollerResponse{}, err - } - result := RunCommandResultPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.RunCommand", "location", resp, client.con.Pipeline(), client.runCommandHandleError) - if err != nil { - return RunCommandResultPollerResponse{}, err - } - poller := &runCommandResultPoller{ - pt: pt, + return VirtualMachineScaleSetVMsRunCommandPollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (RunCommandResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetVMsRunCommandPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeRunCommand creates a new RunCommandResultPoller from the specified resume token. -// token - The value must come from a previous call to RunCommandResultPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumeRunCommand(ctx context.Context, token string) (RunCommandResultPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.RunCommand", token, client.con.Pipeline(), client.runCommandHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.RunCommand", "location", resp, client.pl, client.runCommandHandleError) if err != nil { - return RunCommandResultPollerResponse{}, err + return VirtualMachineScaleSetVMsRunCommandPollerResponse{}, err } - poller := &runCommandResultPoller{ + result.Poller = &VirtualMachineScaleSetVMsRunCommandPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return RunCommandResultPollerResponse{}, err - } - result := RunCommandResultPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (RunCommandResultResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // RunCommand - Run command on a virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) runCommand(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsBeginRunCommandOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) runCommand(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsBeginRunCommandOptions) (*http.Response, error) { req, err := client.runCommandCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.runCommandHandleError(resp) } return resp, nil } // runCommandCreateRequest creates the RunCommand request. -func (client *VirtualMachineScaleSetVMsClient) runCommandCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsBeginRunCommandOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) runCommandCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters RunCommandInput, options *VirtualMachineScaleSetVMsBeginRunCommandOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1279,49 +1016,48 @@ func (client *VirtualMachineScaleSetVMsClient) runCommandCreateRequest(ctx conte return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json, text/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json, text/json") + return req, runtime.MarshalAsJSON(req, parameters) } // runCommandHandleError handles the RunCommand error response. -func (client *VirtualMachineScaleSetVMsClient) runCommandHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) runCommandHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // SimulateEviction - The operation to simulate the eviction of spot virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) SimulateEviction(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsSimulateEvictionOptions) (*http.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) SimulateEviction(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsSimulateEvictionOptions) (VirtualMachineScaleSetVMsSimulateEvictionResponse, error) { req, err := client.simulateEvictionCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return nil, err + return VirtualMachineScaleSetVMsSimulateEvictionResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return nil, err + return VirtualMachineScaleSetVMsSimulateEvictionResponse{}, err } - if !resp.HasStatusCode(http.StatusNoContent) { - return nil, client.simulateEvictionHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return VirtualMachineScaleSetVMsSimulateEvictionResponse{}, client.simulateEvictionHandleError(resp) } - return resp.Response, nil + return VirtualMachineScaleSetVMsSimulateEvictionResponse{RawResponse: resp}, nil } // simulateEvictionCreateRequest creates the SimulateEviction request. -func (client *VirtualMachineScaleSetVMsClient) simulateEvictionCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsSimulateEvictionOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) simulateEvictionCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsSimulateEvictionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1339,96 +1075,67 @@ func (client *VirtualMachineScaleSetVMsClient) simulateEvictionCreateRequest(ctx return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // simulateEvictionHandleError handles the SimulateEviction error response. -func (client *VirtualMachineScaleSetVMsClient) simulateEvictionHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) simulateEvictionHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginStart - Starts a virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginStart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginStartOptions) (HTTPPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginStart(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginStartOptions) (VirtualMachineScaleSetVMsStartPollerResponse, error) { resp, err := client.start(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.Start", "", resp, client.con.Pipeline(), client.startHandleError) - if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsStartPollerResponse{}, err } - poller := &httpPoller{ - pt: pt, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetVMsStartPollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeStart creates a new HTTPPoller from the specified resume token. -// token - The value must come from a previous call to HTTPPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumeStart(ctx context.Context, token string) (HTTPPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Start", token, client.con.Pipeline(), client.startHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.Start", "", resp, client.pl, client.startHandleError) if err != nil { - return HTTPPollerResponse{}, err + return VirtualMachineScaleSetVMsStartPollerResponse{}, err } - poller := &httpPoller{ + result.Poller = &VirtualMachineScaleSetVMsStartPoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return HTTPPollerResponse{}, err - } - result := HTTPPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (*http.Response, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Start - Starts a virtual machine in a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginStartOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) start(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginStartOptions) (*http.Response, error) { req, err := client.startCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.startHandleError(resp) } return resp, nil } // startCreateRequest creates the Start request. -func (client *VirtualMachineScaleSetVMsClient) startCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginStartOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) startCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, options *VirtualMachineScaleSetVMsBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1446,96 +1153,67 @@ func (client *VirtualMachineScaleSetVMsClient) startCreateRequest(ctx context.Co return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPost, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } // startHandleError handles the Start error response. -func (client *VirtualMachineScaleSetVMsClient) startHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) startHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } // BeginUpdate - Updates a virtual machine of a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsBeginUpdateOptions) (VirtualMachineScaleSetVMPollerResponse, error) { +func (client *VirtualMachineScaleSetVMsClient) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsBeginUpdateOptions) (VirtualMachineScaleSetVMsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) if err != nil { - return VirtualMachineScaleSetVMPollerResponse{}, err - } - result := VirtualMachineScaleSetVMPollerResponse{ - RawResponse: resp.Response, - } - pt, err := armcore.NewLROPoller("VirtualMachineScaleSetVMsClient.Update", "", resp, client.con.Pipeline(), client.updateHandleError) - if err != nil { - return VirtualMachineScaleSetVMPollerResponse{}, err - } - poller := &virtualMachineScaleSetVMPoller{ - pt: pt, + return VirtualMachineScaleSetVMsUpdatePollerResponse{}, err } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetVMResponse, error) { - return poller.pollUntilDone(ctx, frequency) + result := VirtualMachineScaleSetVMsUpdatePollerResponse{ + RawResponse: resp, } - return result, nil -} - -// ResumeUpdate creates a new VirtualMachineScaleSetVMPoller from the specified resume token. -// token - The value must come from a previous call to VirtualMachineScaleSetVMPoller.ResumeToken(). -func (client *VirtualMachineScaleSetVMsClient) ResumeUpdate(ctx context.Context, token string) (VirtualMachineScaleSetVMPollerResponse, error) { - pt, err := armcore.NewLROPollerFromResumeToken("VirtualMachineScaleSetVMsClient.Update", token, client.con.Pipeline(), client.updateHandleError) + pt, err := armruntime.NewPoller("VirtualMachineScaleSetVMsClient.Update", "", resp, client.pl, client.updateHandleError) if err != nil { - return VirtualMachineScaleSetVMPollerResponse{}, err + return VirtualMachineScaleSetVMsUpdatePollerResponse{}, err } - poller := &virtualMachineScaleSetVMPoller{ + result.Poller = &VirtualMachineScaleSetVMsUpdatePoller{ pt: pt, } - resp, err := poller.Poll(ctx) - if err != nil { - return VirtualMachineScaleSetVMPollerResponse{}, err - } - result := VirtualMachineScaleSetVMPollerResponse{ - RawResponse: resp, - } - result.Poller = poller - result.PollUntilDone = func(ctx context.Context, frequency time.Duration) (VirtualMachineScaleSetVMResponse, error) { - return poller.pollUntilDone(ctx, frequency) - } return result, nil } // Update - Updates a virtual machine of a VM scale set. // If the operation fails it returns a generic error. -func (client *VirtualMachineScaleSetVMsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsBeginUpdateOptions) (*azcore.Response, error) { +func (client *VirtualMachineScaleSetVMsClient) update(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, vmScaleSetName, instanceID, parameters, options) if err != nil { return nil, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { return nil, err } - if !resp.HasStatusCode(http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { return nil, client.updateHandleError(resp) } return resp, nil } // updateCreateRequest creates the Update request. -func (client *VirtualMachineScaleSetVMsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsBeginUpdateOptions) (*azcore.Request, error) { +func (client *VirtualMachineScaleSetVMsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, parameters VirtualMachineScaleSetVM, options *VirtualMachineScaleSetVMsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -1553,26 +1231,25 @@ func (client *VirtualMachineScaleSetVMsClient) updateCreateRequest(ctx context.C return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodPut, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") - return req, req.MarshalAsJSON(parameters) + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) } // updateHandleError handles the Update error response. -func (client *VirtualMachineScaleSetVMsClient) updateHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineScaleSetVMsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) } diff --git a/sdk/compute/armcompute/zz_generated_virtualmachinesizes_client.go b/sdk/compute/armcompute/zz_generated_virtualmachinesizes_client.go index 5201dee9fecc..6e1ded2d8b15 100644 --- a/sdk/compute/armcompute/zz_generated_virtualmachinesizes_client.go +++ b/sdk/compute/armcompute/zz_generated_virtualmachinesizes_client.go @@ -1,4 +1,5 @@ -// +build go1.13 +//go:build go1.16 +// +build go1.16 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,44 +11,47 @@ package armcompute import ( "context" "errors" - "github.com/Azure/azure-sdk-for-go/sdk/armcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "net/http" "net/url" "strings" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineSizesClient contains the methods for the VirtualMachineSizes group. // Don't use this type directly, use NewVirtualMachineSizesClient() instead. type VirtualMachineSizesClient struct { - con *armcore.Connection + ep string + pl runtime.Pipeline subscriptionID string } // NewVirtualMachineSizesClient creates a new instance of VirtualMachineSizesClient with the specified values. -func NewVirtualMachineSizesClient(con *armcore.Connection, subscriptionID string) *VirtualMachineSizesClient { - return &VirtualMachineSizesClient{con: con, subscriptionID: subscriptionID} +func NewVirtualMachineSizesClient(con *arm.Connection, subscriptionID string) *VirtualMachineSizesClient { + return &VirtualMachineSizesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} } // List - This API is deprecated. Use Resources Skus [https://docs.microsoft.com/rest/api/compute/resourceskus/list] // If the operation fails it returns a generic error. -func (client *VirtualMachineSizesClient) List(ctx context.Context, location string, options *VirtualMachineSizesListOptions) (VirtualMachineSizeListResultResponse, error) { +func (client *VirtualMachineSizesClient) List(ctx context.Context, location string, options *VirtualMachineSizesListOptions) (VirtualMachineSizesListResponse, error) { req, err := client.listCreateRequest(ctx, location, options) if err != nil { - return VirtualMachineSizeListResultResponse{}, err + return VirtualMachineSizesListResponse{}, err } - resp, err := client.con.Pipeline().Do(req) + resp, err := client.pl.Do(req) if err != nil { - return VirtualMachineSizeListResultResponse{}, err + return VirtualMachineSizesListResponse{}, err } - if !resp.HasStatusCode(http.StatusOK) { - return VirtualMachineSizeListResultResponse{}, client.listHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VirtualMachineSizesListResponse{}, client.listHandleError(resp) } return client.listHandleResponse(resp) } // listCreateRequest creates the List request. -func (client *VirtualMachineSizesClient) listCreateRequest(ctx context.Context, location string, options *VirtualMachineSizesListOptions) (*azcore.Request, error) { +func (client *VirtualMachineSizesClient) listCreateRequest(ctx context.Context, location string, options *VirtualMachineSizesListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes" if location == "" { return nil, errors.New("parameter location cannot be empty") @@ -57,35 +61,34 @@ func (client *VirtualMachineSizesClient) listCreateRequest(ctx context.Context, return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } - req.Telemetry(telemetryInfo) - reqQP := req.URL.Query() - reqQP.Set("api-version", "2021-03-01") - req.URL.RawQuery = reqQP.Encode() - req.Header.Set("Accept", "application/json") + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *VirtualMachineSizesClient) listHandleResponse(resp *azcore.Response) (VirtualMachineSizeListResultResponse, error) { - var val *VirtualMachineSizeListResult - if err := resp.UnmarshalAsJSON(&val); err != nil { - return VirtualMachineSizeListResultResponse{}, err +func (client *VirtualMachineSizesClient) listHandleResponse(resp *http.Response) (VirtualMachineSizesListResponse, error) { + result := VirtualMachineSizesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineSizeListResult); err != nil { + return VirtualMachineSizesListResponse{}, err } - return VirtualMachineSizeListResultResponse{RawResponse: resp.Response, VirtualMachineSizeListResult: val}, nil + return result, nil } // listHandleError handles the List error response. -func (client *VirtualMachineSizesClient) listHandleError(resp *azcore.Response) error { - body, err := resp.Payload() +func (client *VirtualMachineSizesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) if err != nil { - return azcore.NewResponseError(err, resp.Response) + return runtime.NewResponseError(err, resp) } if len(body) == 0 { - return azcore.NewResponseError(errors.New(resp.Status), resp.Response) + return runtime.NewResponseError(errors.New(resp.Status), resp) } - return azcore.NewResponseError(errors.New(string(body)), resp.Response) + return runtime.NewResponseError(errors.New(string(body)), resp) }