From 8d58f0881622cc3e1ddd83f4ddb978f3e6cf0e53 Mon Sep 17 00:00:00 2001 From: 804873052 <804873052@qq.com> Date: Fri, 17 Dec 2021 11:30:33 +0800 Subject: [PATCH 1/2] [Release] sdk/resourcemanager/resourcemover/armresourcemover/0.1.0 generation from spec commit: 7086ee861c3a6196bb98f8b327af11d03e545a05 --- .../armresourcemover/CHANGELOG.md | 5 + .../armresourcemover/LICENSE.txt | 21 + .../resourcemover/armresourcemover/README.md | 75 + .../armresourcemover/autorest.md | 13 + .../resourcemover/armresourcemover/build.go | 7 + .../resourcemover/armresourcemover/ci.yml | 27 + .../resourcemover/armresourcemover/go.mod | 9 + .../resourcemover/armresourcemover/go.sum | 45 + .../armresourcemover/go_mod_tidy_hack.go | 13 + ...ted_example_movecollections_client_test.go | 328 +++ ...rated_example_moveresources_client_test.go | 127 ++ ...example_operationsdiscovery_client_test.go | 32 + ...mple_unresolveddependencies_client_test.go | 41 + .../zz_generated_constants.go | 282 +++ .../armresourcemover/zz_generated_models.go | 1756 +++++++++++++++++ .../zz_generated_movecollections_client.go | 997 ++++++++++ .../zz_generated_moveresources_client.go | 340 ++++ ...zz_generated_operationsdiscovery_client.go | 92 + .../armresourcemover/zz_generated_pagers.go | 233 +++ .../armresourcemover/zz_generated_pollers.go | 402 ++++ .../zz_generated_polymorphic_helpers.go | 91 + .../zz_generated_response_types.go | 604 ++++++ .../zz_generated_time_rfc3339.go | 85 + ...generated_unresolveddependencies_client.go | 114 ++ 24 files changed, 5739 insertions(+) create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/CHANGELOG.md create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/LICENSE.txt create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/README.md create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/autorest.md create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/build.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/ci.yml create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/go.mod create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/go.sum create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/go_mod_tidy_hack.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_movecollections_client_test.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_moveresources_client_test.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_operationsdiscovery_client_test.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_unresolveddependencies_client_test.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_constants.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_models.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_movecollections_client.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_moveresources_client.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_operationsdiscovery_client.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_pagers.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_pollers.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_polymorphic_helpers.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_response_types.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_time_rfc3339.go create mode 100644 sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_unresolveddependencies_client.go diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/CHANGELOG.md b/sdk/resourcemanager/resourcemover/armresourcemover/CHANGELOG.md new file mode 100644 index 000000000000..fe78cfc7719e --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (2021-12-17) + +- Init release. \ No newline at end of file diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/LICENSE.txt b/sdk/resourcemanager/resourcemover/armresourcemover/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/README.md b/sdk/resourcemanager/resourcemover/armresourcemover/README.md new file mode 100644 index 000000000000..f1a64f296057 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/README.md @@ -0,0 +1,75 @@ +# Azure Resource Mover Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcemover/armresourcemover)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcemover/armresourcemover) + +The `armresourcemover` module provides operations for working with Azure Resource Mover. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/resourcemover/armresourcemover) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.16 or above + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Resource Mover module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcemover/armresourcemover +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Resource Mover. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Clients + +Azure Resource Mover 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 credential. + +```go +client := armresourcemover.NewUnresolvedDependenciesClient(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, 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). + +```go +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armresourcemover.NewUnresolvedDependenciesClient(, cred, &options) +``` + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Resource Mover` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/autorest.md b/sdk/resourcemanager/resourcemover/armresourcemover/autorest.md new file mode 100644 index 000000000000..e8bf37be81d3 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- https://github.com/Azure/azure-rest-api-specs/blob/7086ee861c3a6196bb98f8b327af11d03e545a05/specification/resourcemover/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/7086ee861c3a6196bb98f8b327af11d03e545a05/specification/resourcemover/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/build.go b/sdk/resourcemanager/resourcemover/armresourcemover/build.go new file mode 100644 index 000000000000..b1c9c8a63464 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/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 resourcemanager/resourcemover/armresourcemover + +package armresourcemover diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/ci.yml b/sdk/resourcemanager/resourcemover/armresourcemover/ci.yml new file mode 100644 index 000000000000..804f65f28142 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/resourcemover/armresourcemover/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/resourcemover/armresourcemover/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/resourcemover/armresourcemover' diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/go.mod b/sdk/resourcemanager/resourcemover/armresourcemover/go.mod new file mode 100644 index 000000000000..fdac1526a417 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/go.mod @@ -0,0 +1,9 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcemover/armresourcemover + +go 1.16 + +require ( + github.com/Azure/azure-sdk-for-go v60.2.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0 +) diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/go.sum b/sdk/resourcemanager/resourcemover/armresourcemover/go.sum new file mode 100644 index 000000000000..064107e5c3c6 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/go.sum @@ -0,0 +1,45 @@ +github.com/Azure/azure-sdk-for-go v60.2.0+incompatible h1:twJOQQl3um6o+1q5SSyAdLr2GCX8dJPVRNS1eKOnv54= +github.com/Azure/azure-sdk-for-go v60.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0 h1:VBvHGLJbaY0+c66NZHdS9cgjHVYSH6DDa0XJMyrblsI= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.12.0/go.mod h1:GJzjM4SR9T0KyX5gKCVyz1ytD8FeWeUPCwtFCt1AyfE= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= +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-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/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.1/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/resourcemanager/resourcemover/armresourcemover/go_mod_tidy_hack.go b/sdk/resourcemanager/resourcemover/armresourcemover/go_mod_tidy_hack.go new file mode 100644 index 000000000000..f1d84a928a65 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/go_mod_tidy_hack.go @@ -0,0 +1,13 @@ +//go:build modhack +// +build modhack + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file, and the github.com/Azure/azure-sdk-for-go import, won't actually become part of +// the resultant binary. + +package armresourcemover + +// Necessary for safely adding multi-module repo. See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository +import _ "github.com/Azure/azure-sdk-for-go" diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_movecollections_client_test.go b/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_movecollections_client_test.go new file mode 100644 index 000000000000..1ed377a8ceb1 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_movecollections_client_test.go @@ -0,0 +1,328 @@ +//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 armresourcemover_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcemover/armresourcemover" +) + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Create.json +func ExampleMoveCollectionsClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + res, err := client.Create(ctx, + "", + "", + &armresourcemover.MoveCollectionsCreateOptions{Body: &armresourcemover.MoveCollection{ + Identity: &armresourcemover.Identity{ + Type: armresourcemover.ResourceIdentityTypeSystemAssigned.ToPtr(), + }, + Location: to.StringPtr(""), + Properties: &armresourcemover.MoveCollectionProperties{ + SourceRegion: to.StringPtr(""), + TargetRegion: to.StringPtr(""), + }, + }, + }) + if err != nil { + log.Fatal(err) + } + log.Printf("MoveCollection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Update.json +func ExampleMoveCollectionsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + res, err := client.Update(ctx, + "", + "", + &armresourcemover.MoveCollectionsUpdateOptions{Body: &armresourcemover.UpdateMoveCollectionRequest{ + Identity: &armresourcemover.Identity{ + Type: armresourcemover.ResourceIdentityTypeSystemAssigned.ToPtr(), + }, + Tags: map[string]*string{ + "key1": to.StringPtr("mc1"), + }, + }, + }) + if err != nil { + log.Fatal(err) + } + log.Printf("MoveCollection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Delete.json +func ExampleMoveCollectionsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("OperationStatus.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Get.json +func ExampleMoveCollectionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("MoveCollection.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Prepare.json +func ExampleMoveCollectionsClient_BeginPrepare() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + poller, err := client.BeginPrepare(ctx, + "", + "", + &armresourcemover.MoveCollectionsBeginPrepareOptions{Body: &armresourcemover.PrepareRequest{ + MoveResources: []*string{ + to.StringPtr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1")}, + ValidateOnly: to.BoolPtr(false), + }, + }) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("OperationStatus.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_InitiateMove.json +func ExampleMoveCollectionsClient_BeginInitiateMove() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + poller, err := client.BeginInitiateMove(ctx, + "", + "", + &armresourcemover.MoveCollectionsBeginInitiateMoveOptions{Body: &armresourcemover.ResourceMoveRequest{ + MoveResources: []*string{ + to.StringPtr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1")}, + ValidateOnly: to.BoolPtr(false), + }, + }) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("OperationStatus.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Commit.json +func ExampleMoveCollectionsClient_BeginCommit() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + poller, err := client.BeginCommit(ctx, + "", + "", + &armresourcemover.MoveCollectionsBeginCommitOptions{Body: &armresourcemover.CommitRequest{ + MoveResources: []*string{ + to.StringPtr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1")}, + ValidateOnly: to.BoolPtr(false), + }, + }) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("OperationStatus.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Discard.json +func ExampleMoveCollectionsClient_BeginDiscard() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + poller, err := client.BeginDiscard(ctx, + "", + "", + &armresourcemover.MoveCollectionsBeginDiscardOptions{Body: &armresourcemover.DiscardRequest{ + MoveResources: []*string{ + to.StringPtr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1")}, + ValidateOnly: to.BoolPtr(false), + }, + }) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("OperationStatus.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ResolveDependencies.json +func ExampleMoveCollectionsClient_BeginResolveDependencies() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + poller, err := client.BeginResolveDependencies(ctx, + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("OperationStatus.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_BulkRemove.json +func ExampleMoveCollectionsClient_BeginBulkRemove() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + poller, err := client.BeginBulkRemove(ctx, + "", + "", + &armresourcemover.MoveCollectionsBeginBulkRemoveOptions{Body: &armresourcemover.BulkRemoveRequest{ + MoveResources: []*string{ + to.StringPtr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1")}, + ValidateOnly: to.BoolPtr(false), + }, + }) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("OperationStatus.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsBySubscription.json +func ExampleMoveCollectionsClient_ListMoveCollectionsBySubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + pager := client.ListMoveCollectionsBySubscription(nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("MoveCollection.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsByResourceGroup.json +func ExampleMoveCollectionsClient_ListMoveCollectionsByResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + pager := client.ListMoveCollectionsByResourceGroup("", + nil) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("MoveCollection.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/RequiredFor_Get.json +func ExampleMoveCollectionsClient_ListRequiredFor() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveCollectionsClient("", cred, nil) + _, err = client.ListRequiredFor(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_moveresources_client_test.go b/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_moveresources_client_test.go new file mode 100644 index 000000000000..bcb17602b021 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_moveresources_client_test.go @@ -0,0 +1,127 @@ +//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 armresourcemover_test + +import ( + "context" + "log" + + "time" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcemover/armresourcemover" +) + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_List.json +func ExampleMoveResourcesClient_List() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveResourcesClient("", cred, nil) + pager := client.List("", + "", + &armresourcemover.MoveResourcesListOptions{Filter: nil}) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("MoveResource.ID: %s\n", *v.ID) + } + } +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Create.json +func ExampleMoveResourcesClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveResourcesClient("", cred, nil) + poller, err := client.BeginCreate(ctx, + "", + "", + "", + &armresourcemover.MoveResourcesBeginCreateOptions{Body: &armresourcemover.MoveResource{ + Properties: &armresourcemover.MoveResourceProperties{ + DependsOnOverrides: []*armresourcemover.MoveResourceDependencyOverride{ + { + ID: to.StringPtr(""), + TargetID: to.StringPtr(""), + }}, + ResourceSettings: &armresourcemover.VirtualMachineResourceSettings{ + ResourceSettings: armresourcemover.ResourceSettings{ + ResourceType: to.StringPtr(""), + TargetResourceName: to.StringPtr(""), + }, + TargetAvailabilitySetID: to.StringPtr(""), + TargetAvailabilityZone: armresourcemover.TargetAvailabilityZoneTwo.ToPtr(), + TargetVMSize: to.StringPtr(""), + UserManagedIdentities: []*string{ + to.StringPtr("/subscriptions/subid/resourceGroups/eastusRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/umi1")}, + }, + SourceID: to.StringPtr(""), + }, + }, + }) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("MoveResource.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Delete.json +func ExampleMoveResourcesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveResourcesClient("", cred, nil) + poller, err := client.BeginDelete(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + res, err := poller.PollUntilDone(ctx, 30*time.Second) + if err != nil { + log.Fatal(err) + } + log.Printf("OperationStatus.ID: %s\n", *res.ID) +} + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Get.json +func ExampleMoveResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewMoveResourcesClient("", cred, nil) + res, err := client.Get(ctx, + "", + "", + "", + nil) + if err != nil { + log.Fatal(err) + } + log.Printf("MoveResource.ID: %s\n", *res.ID) +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_operationsdiscovery_client_test.go b/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_operationsdiscovery_client_test.go new file mode 100644 index 000000000000..a3565c7e479d --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_operationsdiscovery_client_test.go @@ -0,0 +1,32 @@ +//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 armresourcemover_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcemover/armresourcemover" +) + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/OperationsDiscovery_Get.json +func ExampleOperationsDiscoveryClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewOperationsDiscoveryClient(cred, nil) + _, err = client.Get(ctx, + nil) + if err != nil { + log.Fatal(err) + } +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_unresolveddependencies_client_test.go b/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_unresolveddependencies_client_test.go new file mode 100644 index 000000000000..fb58c027e5e7 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/ze_generated_example_unresolveddependencies_client_test.go @@ -0,0 +1,41 @@ +//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 armresourcemover_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcemover/armresourcemover" +) + +// x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/UnresolvedDependencies_Get.json +func ExampleUnresolvedDependenciesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client := armresourcemover.NewUnresolvedDependenciesClient("", cred, nil) + pager := client.Get("", + "", + &armresourcemover.UnresolvedDependenciesGetOptions{DependencyLevel: nil, + Orderby: nil, + Filter: nil, + }) + for pager.NextPage(ctx) { + if err := pager.Err(); err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range pager.PageResponse().Value { + log.Printf("UnresolvedDependency.ID: %s\n", *v.ID) + } + } +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_constants.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_constants.go new file mode 100644 index 000000000000..70f33ed632b9 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_constants.go @@ -0,0 +1,282 @@ +//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 armresourcemover + +const ( + module = "armresourcemover" + version = "v0.1.0" +) + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// ToPtr returns a *CreatedByType pointing to the current value. +func (c CreatedByType) ToPtr() *CreatedByType { + return &c +} + +type DependencyLevel string + +const ( + DependencyLevelDescendant DependencyLevel = "Descendant" + DependencyLevelDirect DependencyLevel = "Direct" +) + +// PossibleDependencyLevelValues returns the possible values for the DependencyLevel const type. +func PossibleDependencyLevelValues() []DependencyLevel { + return []DependencyLevel{ + DependencyLevelDescendant, + DependencyLevelDirect, + } +} + +// ToPtr returns a *DependencyLevel pointing to the current value. +func (c DependencyLevel) ToPtr() *DependencyLevel { + return &c +} + +// DependencyType - Defines the dependency type. +type DependencyType string + +const ( + DependencyTypeRequiredForMove DependencyType = "RequiredForMove" + DependencyTypeRequiredForPrepare DependencyType = "RequiredForPrepare" +) + +// PossibleDependencyTypeValues returns the possible values for the DependencyType const type. +func PossibleDependencyTypeValues() []DependencyType { + return []DependencyType{ + DependencyTypeRequiredForMove, + DependencyTypeRequiredForPrepare, + } +} + +// ToPtr returns a *DependencyType pointing to the current value. +func (c DependencyType) ToPtr() *DependencyType { + return &c +} + +// JobName - Defines the job name. +type JobName string + +const ( + JobNameInitialSync JobName = "InitialSync" +) + +// PossibleJobNameValues returns the possible values for the JobName const type. +func PossibleJobNameValues() []JobName { + return []JobName{ + JobNameInitialSync, + } +} + +// ToPtr returns a *JobName pointing to the current value. +func (c JobName) ToPtr() *JobName { + return &c +} + +// MoveResourceInputType - Defines the move resource input type. +type MoveResourceInputType string + +const ( + MoveResourceInputTypeMoveResourceID MoveResourceInputType = "MoveResourceId" + MoveResourceInputTypeMoveResourceSourceID MoveResourceInputType = "MoveResourceSourceId" +) + +// PossibleMoveResourceInputTypeValues returns the possible values for the MoveResourceInputType const type. +func PossibleMoveResourceInputTypeValues() []MoveResourceInputType { + return []MoveResourceInputType{ + MoveResourceInputTypeMoveResourceID, + MoveResourceInputTypeMoveResourceSourceID, + } +} + +// ToPtr returns a *MoveResourceInputType pointing to the current value. +func (c MoveResourceInputType) ToPtr() *MoveResourceInputType { + return &c +} + +// MoveState - Defines the MoveResource states. +type MoveState string + +const ( + MoveStateAssignmentPending MoveState = "AssignmentPending" + MoveStateCommitFailed MoveState = "CommitFailed" + MoveStateCommitInProgress MoveState = "CommitInProgress" + MoveStateCommitPending MoveState = "CommitPending" + MoveStateCommitted MoveState = "Committed" + MoveStateDeleteSourcePending MoveState = "DeleteSourcePending" + MoveStateDiscardFailed MoveState = "DiscardFailed" + MoveStateDiscardInProgress MoveState = "DiscardInProgress" + MoveStateMoveFailed MoveState = "MoveFailed" + MoveStateMoveInProgress MoveState = "MoveInProgress" + MoveStateMovePending MoveState = "MovePending" + MoveStatePrepareFailed MoveState = "PrepareFailed" + MoveStatePrepareInProgress MoveState = "PrepareInProgress" + MoveStatePreparePending MoveState = "PreparePending" + MoveStateResourceMoveCompleted MoveState = "ResourceMoveCompleted" +) + +// PossibleMoveStateValues returns the possible values for the MoveState const type. +func PossibleMoveStateValues() []MoveState { + return []MoveState{ + MoveStateAssignmentPending, + MoveStateCommitFailed, + MoveStateCommitInProgress, + MoveStateCommitPending, + MoveStateCommitted, + MoveStateDeleteSourcePending, + MoveStateDiscardFailed, + MoveStateDiscardInProgress, + MoveStateMoveFailed, + MoveStateMoveInProgress, + MoveStateMovePending, + MoveStatePrepareFailed, + MoveStatePrepareInProgress, + MoveStatePreparePending, + MoveStateResourceMoveCompleted, + } +} + +// ToPtr returns a *MoveState pointing to the current value. +func (c MoveState) ToPtr() *MoveState { + return &c +} + +// ProvisioningState - Defines the provisioning states. +type ProvisioningState string + +const ( + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCreating, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// ToPtr returns a *ProvisioningState pointing to the current value. +func (c ProvisioningState) ToPtr() *ProvisioningState { + return &c +} + +// ResolutionType - Defines the resolution type. +type ResolutionType string + +const ( + ResolutionTypeAutomatic ResolutionType = "Automatic" + ResolutionTypeManual ResolutionType = "Manual" +) + +// PossibleResolutionTypeValues returns the possible values for the ResolutionType const type. +func PossibleResolutionTypeValues() []ResolutionType { + return []ResolutionType{ + ResolutionTypeAutomatic, + ResolutionTypeManual, + } +} + +// ToPtr returns a *ResolutionType pointing to the current value. +func (c ResolutionType) ToPtr() *ResolutionType { + return &c +} + +// ResourceIdentityType - The type of identity used for the resource mover service. +type ResourceIdentityType string + +const ( + ResourceIdentityTypeNone ResourceIdentityType = "None" + ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" + ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" +) + +// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{ + ResourceIdentityTypeNone, + ResourceIdentityTypeSystemAssigned, + ResourceIdentityTypeUserAssigned, + } +} + +// ToPtr returns a *ResourceIdentityType pointing to the current value. +func (c ResourceIdentityType) ToPtr() *ResourceIdentityType { + return &c +} + +// TargetAvailabilityZone - Gets or sets the target availability zone. +type TargetAvailabilityZone string + +const ( + TargetAvailabilityZoneNA TargetAvailabilityZone = "NA" + TargetAvailabilityZoneOne TargetAvailabilityZone = "1" + TargetAvailabilityZoneThree TargetAvailabilityZone = "3" + TargetAvailabilityZoneTwo TargetAvailabilityZone = "2" +) + +// PossibleTargetAvailabilityZoneValues returns the possible values for the TargetAvailabilityZone const type. +func PossibleTargetAvailabilityZoneValues() []TargetAvailabilityZone { + return []TargetAvailabilityZone{ + TargetAvailabilityZoneNA, + TargetAvailabilityZoneOne, + TargetAvailabilityZoneThree, + TargetAvailabilityZoneTwo, + } +} + +// ToPtr returns a *TargetAvailabilityZone pointing to the current value. +func (c TargetAvailabilityZone) ToPtr() *TargetAvailabilityZone { + return &c +} + +// ZoneRedundant - Defines the zone redundant resource setting. +type ZoneRedundant string + +const ( + ZoneRedundantDisable ZoneRedundant = "Disable" + ZoneRedundantEnable ZoneRedundant = "Enable" +) + +// PossibleZoneRedundantValues returns the possible values for the ZoneRedundant const type. +func PossibleZoneRedundantValues() []ZoneRedundant { + return []ZoneRedundant{ + ZoneRedundantDisable, + ZoneRedundantEnable, + } +} + +// ToPtr returns a *ZoneRedundant pointing to the current value. +func (c ZoneRedundant) ToPtr() *ZoneRedundant { + return &c +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_models.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_models.go new file mode 100644 index 000000000000..72dddf8c5451 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_models.go @@ -0,0 +1,1756 @@ +//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 armresourcemover + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "time" +) + +// AffectedMoveResource - The RP custom operation error info. +type AffectedMoveResource struct { + // READ-ONLY; The affected move resource id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The affected move resources. + MoveResources []*AffectedMoveResource `json:"moveResources,omitempty" azure:"ro"` + + // READ-ONLY; The affected move resource source id. + SourceID *string `json:"sourceId,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type AffectedMoveResource. +func (a AffectedMoveResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "moveResources", a.MoveResources) + populate(objectMap, "sourceId", a.SourceID) + return json.Marshal(objectMap) +} + +// AutomaticResolutionProperties - Defines the properties for automatic resolution. +type AutomaticResolutionProperties struct { + // Gets the MoveResource ARM ID of the dependent resource if the resolution type is Automatic. + MoveResourceID *string `json:"moveResourceId,omitempty"` +} + +// AvailabilitySetResourceSettings - Gets or sets the availability set resource settings. +type AvailabilitySetResourceSettings struct { + ResourceSettings + // Gets or sets the target fault domain. + FaultDomain *int32 `json:"faultDomain,omitempty"` + + // Gets or sets the Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // Gets or sets the target update domain. + UpdateDomain *int32 `json:"updateDomain,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AvailabilitySetResourceSettings. +func (a AvailabilitySetResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.ResourceSettings.marshalInternal(objectMap, "Microsoft.Compute/availabilitySets") + populate(objectMap, "faultDomain", a.FaultDomain) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "updateDomain", a.UpdateDomain) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailabilitySetResourceSettings. +func (a *AvailabilitySetResourceSettings) 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 "faultDomain": + err = unpopulate(val, &a.FaultDomain) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &a.Tags) + delete(rawMsg, key) + case "updateDomain": + err = unpopulate(val, &a.UpdateDomain) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.ResourceSettings.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// AzureResourceReference - Defines reference to an Azure resource. +type AzureResourceReference struct { + // REQUIRED; Gets the ARM resource ID of the tracked resource being referenced. + SourceArmResourceID *string `json:"sourceArmResourceId,omitempty"` +} + +// BulkRemoveRequest - Defines the request body for bulk remove of move resources operation. +type BulkRemoveRequest struct { + // Defines the move resource input type. + MoveResourceInputType *MoveResourceInputType `json:"moveResourceInputType,omitempty"` + + // Gets or sets the list of resource Id's, by default it accepts move resource id's unless the input type is switched via moveResourceInputType property. + MoveResources []*string `json:"moveResources,omitempty"` + + // Gets or sets a value indicating whether the operation needs to only run pre-requisite. + ValidateOnly *bool `json:"validateOnly,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BulkRemoveRequest. +func (b BulkRemoveRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "moveResourceInputType", b.MoveResourceInputType) + populate(objectMap, "moveResources", b.MoveResources) + populate(objectMap, "validateOnly", b.ValidateOnly) + return json.Marshal(objectMap) +} + +// CloudError - An error response from the service. +// Implements the error and azcore.HTTPResponse interfaces. +type CloudError struct { + raw string + // Cloud error body. + InnerError *CloudErrorBody `json:"error,omitempty"` +} + +// Error implements the error interface for type CloudError. +// The contents of the error text are not contractual and subject to change. +func (e CloudError) Error() string { + return e.raw +} + +// CloudErrorBody - An error response from the service. +type CloudErrorBody struct { + // An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + + // A list of additional details about the error. + Details []*CloudErrorBody `json:"details,omitempty"` + + // A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + + // The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CloudErrorBody. +func (c CloudErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", c.Code) + populate(objectMap, "details", c.Details) + populate(objectMap, "message", c.Message) + populate(objectMap, "target", c.Target) + return json.Marshal(objectMap) +} + +// CommitRequest - Defines the request body for commit operation. +type CommitRequest struct { + // REQUIRED; Gets or sets the list of resource Id's, by default it accepts move resource id's unless the input type is switched via moveResourceInputType + // property. + MoveResources []*string `json:"moveResources,omitempty"` + + // Defines the move resource input type. + MoveResourceInputType *MoveResourceInputType `json:"moveResourceInputType,omitempty"` + + // Gets or sets a value indicating whether the operation needs to only run pre-requisite. + ValidateOnly *bool `json:"validateOnly,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CommitRequest. +func (c CommitRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "moveResourceInputType", c.MoveResourceInputType) + populate(objectMap, "moveResources", c.MoveResources) + populate(objectMap, "validateOnly", c.ValidateOnly) + return json.Marshal(objectMap) +} + +// DiscardRequest - Defines the request body for discard operation. +type DiscardRequest struct { + // REQUIRED; Gets or sets the list of resource Id's, by default it accepts move resource id's unless the input type is switched via moveResourceInputType + // property. + MoveResources []*string `json:"moveResources,omitempty"` + + // Defines the move resource input type. + MoveResourceInputType *MoveResourceInputType `json:"moveResourceInputType,omitempty"` + + // Gets or sets a value indicating whether the operation needs to only run pre-requisite. + ValidateOnly *bool `json:"validateOnly,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type DiscardRequest. +func (d DiscardRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "moveResourceInputType", d.MoveResourceInputType) + populate(objectMap, "moveResources", d.MoveResources) + populate(objectMap, "validateOnly", d.ValidateOnly) + return json.Marshal(objectMap) +} + +// DiskEncryptionSetResourceSettings - Defines the disk encryption set resource settings. +type DiskEncryptionSetResourceSettings struct { + ResourceSettings +} + +// MarshalJSON implements the json.Marshaller interface for type DiskEncryptionSetResourceSettings. +func (d DiskEncryptionSetResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + d.ResourceSettings.marshalInternal(objectMap, "Microsoft.Compute/diskEncryptionSets") + return json.Marshal(objectMap) +} + +// Display - Contains the localized display information for this particular operation / action. These value will be used by several clients for (1) custom +// role definitions for RBAC; (2) complex query filters for +// the event service; and (3) audit history / records for management operations. +type Display struct { + // Gets or sets the description. The localized friendly description for the operation, as it should be shown to the user. It should be thorough, yet concise + // – it will be used in tool tips and detailed + // views. Prescriptive guidance for namespace: Read any 'display.provider' resource Create or Update any 'display.provider' resource Delete any 'display.provider' + // resource Perform any other action on any + // 'display.provider' resource Prescriptive guidance for namespace: Read any 'display.resource' Create or Update any 'display.resource' Delete any 'display.resource' + // 'ActionName' any 'display.resources'. + Description *string `json:"description,omitempty"` + + // Gets or sets the operation. The localized friendly name for the operation, as it should be shown to the user. It should be concise (to fit in drop downs) + // but clear (i.e. self-documenting). It should + // use Title Casing. Prescriptive guidance: Read Create or Update Delete 'ActionName'. + Operation *string `json:"operation,omitempty"` + + // Gets or sets the provider. The localized friendly form of the resource provider name – it is expected to also include the publisher/company responsible. + // It should use Title Casing and begin with + // "Microsoft" for 1st party services. e.g. "Microsoft Monitoring Insights" or "Microsoft Compute.". + Provider *string `json:"provider,omitempty"` + + // Gets or sets the resource. The localized friendly form of the resource related to this action/operation – it should match the public documentation for + // the resource provider. It should use Title + // Casing. This value should be unique for a particular URL type (e.g. nested types should notreuse their parent’s display.resource field) e.g. "Virtual + // Machines" or "Scheduler Job Collections", or + // "Virtual Machine VM Sizes" or "Scheduler Jobs". + Resource *string `json:"resource,omitempty"` +} + +// Identity - Defines the MSI properties of the Move Collection. +type Identity struct { + // Gets or sets the principal id. + PrincipalID *string `json:"principalId,omitempty"` + + // Gets or sets the tenant id. + TenantID *string `json:"tenantId,omitempty"` + + // The type of identity used for the resource mover service. + Type *ResourceIdentityType `json:"type,omitempty"` +} + +// JobStatus - Defines the job status. +type JobStatus struct { + // READ-ONLY; Defines the job name. + JobName *JobName `json:"jobName,omitempty" azure:"ro"` + + // READ-ONLY; Gets or sets the monitoring job percentage. + JobProgress *string `json:"jobProgress,omitempty" azure:"ro"` +} + +// KeyVaultResourceSettings - Defines the key vault resource settings. +type KeyVaultResourceSettings struct { + ResourceSettings +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultResourceSettings. +func (k KeyVaultResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + k.ResourceSettings.marshalInternal(objectMap, "Microsoft.KeyVault/vaults") + return json.Marshal(objectMap) +} + +// LBBackendAddressPoolResourceSettings - Defines load balancer backend address pool properties. +type LBBackendAddressPoolResourceSettings struct { + // Gets or sets the backend address pool name. + Name *string `json:"name,omitempty"` +} + +// LBFrontendIPConfigurationResourceSettings - Defines load balancer frontend IP configuration properties. +type LBFrontendIPConfigurationResourceSettings struct { + // Gets or sets the frontend IP configuration name. + Name *string `json:"name,omitempty"` + + // Gets or sets the IP address of the Load Balancer.This is only specified if a specific private IP address shall be allocated from the subnet specified + // in subnetRef. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + + // Gets or sets PrivateIP allocation method (Static/Dynamic). + PrivateIPAllocationMethod *string `json:"privateIpAllocationMethod,omitempty"` + + // Defines reference to subnet. + Subnet *SubnetReference `json:"subnet,omitempty"` + + // Gets or sets the csv list of zones. + Zones *string `json:"zones,omitempty"` +} + +// LoadBalancerBackendAddressPoolReference - Defines reference to load balancer backend address pools. +type LoadBalancerBackendAddressPoolReference struct { + ProxyResourceReference +} + +// LoadBalancerNatRuleReference - Defines reference to load balancer NAT rules. +type LoadBalancerNatRuleReference struct { + ProxyResourceReference +} + +// LoadBalancerResourceSettings - Defines the load balancer resource settings. +type LoadBalancerResourceSettings struct { + ResourceSettings + // Gets or sets the backend address pools of the load balancer. + BackendAddressPools []*LBBackendAddressPoolResourceSettings `json:"backendAddressPools,omitempty"` + + // Gets or sets the frontend IP configurations of the load balancer. + FrontendIPConfigurations []*LBFrontendIPConfigurationResourceSettings `json:"frontendIPConfigurations,omitempty"` + + // Gets or sets load balancer sku (Basic/Standard). + SKU *string `json:"sku,omitempty"` + + // Gets or sets the Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // Gets or sets the csv list of zones common for all frontend IP configurations. Note this is given precedence only if frontend IP configurations settings + // are not present. + Zones *string `json:"zones,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerResourceSettings. +func (l LoadBalancerResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + l.ResourceSettings.marshalInternal(objectMap, "Microsoft.Network/loadBalancers") + populate(objectMap, "backendAddressPools", l.BackendAddressPools) + populate(objectMap, "frontendIPConfigurations", l.FrontendIPConfigurations) + populate(objectMap, "sku", l.SKU) + populate(objectMap, "tags", l.Tags) + populate(objectMap, "zones", l.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadBalancerResourceSettings. +func (l *LoadBalancerResourceSettings) 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 "backendAddressPools": + err = unpopulate(val, &l.BackendAddressPools) + delete(rawMsg, key) + case "frontendIPConfigurations": + err = unpopulate(val, &l.FrontendIPConfigurations) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, &l.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &l.Tags) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, &l.Zones) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := l.ResourceSettings.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// ManualResolutionProperties - Defines the properties for manual resolution. +type ManualResolutionProperties struct { + // Gets or sets the target resource ARM ID of the dependent resource if the resource type is Manual. + TargetID *string `json:"targetId,omitempty"` +} + +// MoveCollection - Define the move collection. +type MoveCollection struct { + // Defines the MSI properties of the Move Collection. + Identity *Identity `json:"identity,omitempty"` + + // The geo-location where the resource lives. + Location *string `json:"location,omitempty"` + + // Defines the move collection properties. + Properties *MoveCollectionProperties `json:"properties,omitempty"` + + // Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The etag of the resource. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MoveCollection. +func (m MoveCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// MoveCollectionProperties - Defines the move collection properties. +type MoveCollectionProperties struct { + // REQUIRED; Gets or sets the source region. + SourceRegion *string `json:"sourceRegion,omitempty"` + + // REQUIRED; Gets or sets the target region. + TargetRegion *string `json:"targetRegion,omitempty"` + + // READ-ONLY; Defines the move collection errors. + Errors *MoveCollectionPropertiesErrors `json:"errors,omitempty" azure:"ro"` + + // READ-ONLY; Defines the provisioning states. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// MoveCollectionPropertiesErrors - Defines the move collection errors. +type MoveCollectionPropertiesErrors struct { + MoveResourceError +} + +// MoveCollectionResultList - Defines the collection of move collections. +type MoveCollectionResultList struct { + // Gets the value of next link. + NextLink *string `json:"nextLink,omitempty"` + + // Gets the list of move collections. + Value []*MoveCollection `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MoveCollectionResultList. +func (m MoveCollectionResultList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// MoveCollectionsBeginBulkRemoveOptions contains the optional parameters for the MoveCollections.BeginBulkRemove method. +type MoveCollectionsBeginBulkRemoveOptions struct { + Body *BulkRemoveRequest +} + +// MoveCollectionsBeginCommitOptions contains the optional parameters for the MoveCollections.BeginCommit method. +type MoveCollectionsBeginCommitOptions struct { + Body *CommitRequest +} + +// MoveCollectionsBeginDeleteOptions contains the optional parameters for the MoveCollections.BeginDelete method. +type MoveCollectionsBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// MoveCollectionsBeginDiscardOptions contains the optional parameters for the MoveCollections.BeginDiscard method. +type MoveCollectionsBeginDiscardOptions struct { + Body *DiscardRequest +} + +// MoveCollectionsBeginInitiateMoveOptions contains the optional parameters for the MoveCollections.BeginInitiateMove method. +type MoveCollectionsBeginInitiateMoveOptions struct { + Body *ResourceMoveRequest +} + +// MoveCollectionsBeginPrepareOptions contains the optional parameters for the MoveCollections.BeginPrepare method. +type MoveCollectionsBeginPrepareOptions struct { + Body *PrepareRequest +} + +// MoveCollectionsBeginResolveDependenciesOptions contains the optional parameters for the MoveCollections.BeginResolveDependencies method. +type MoveCollectionsBeginResolveDependenciesOptions struct { + // placeholder for future optional parameters +} + +// MoveCollectionsCreateOptions contains the optional parameters for the MoveCollections.Create method. +type MoveCollectionsCreateOptions struct { + Body *MoveCollection +} + +// MoveCollectionsGetOptions contains the optional parameters for the MoveCollections.Get method. +type MoveCollectionsGetOptions struct { + // placeholder for future optional parameters +} + +// MoveCollectionsListMoveCollectionsByResourceGroupOptions contains the optional parameters for the MoveCollections.ListMoveCollectionsByResourceGroup +// method. +type MoveCollectionsListMoveCollectionsByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// MoveCollectionsListMoveCollectionsBySubscriptionOptions contains the optional parameters for the MoveCollections.ListMoveCollectionsBySubscription method. +type MoveCollectionsListMoveCollectionsBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// MoveCollectionsListRequiredForOptions contains the optional parameters for the MoveCollections.ListRequiredFor method. +type MoveCollectionsListRequiredForOptions struct { + // placeholder for future optional parameters +} + +// MoveCollectionsUpdateOptions contains the optional parameters for the MoveCollections.Update method. +type MoveCollectionsUpdateOptions struct { + Body *UpdateMoveCollectionRequest +} + +// MoveErrorInfo - The move custom error info. +type MoveErrorInfo struct { + // READ-ONLY; The affected move resources. + MoveResources []*AffectedMoveResource `json:"moveResources,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MoveErrorInfo. +func (m MoveErrorInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "moveResources", m.MoveResources) + return json.Marshal(objectMap) +} + +// MoveResource - Defines the move resource. +type MoveResource struct { + // Defines the move resource properties. + Properties *MoveResourceProperties `json:"properties,omitempty"` + + // READ-ONLY; Fully qualified resource Id for the resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MoveResourceCollection - Defines the collection of move resources. +type MoveResourceCollection struct { + // Gets the value of next link. + NextLink *string `json:"nextLink,omitempty"` + + // Gets or sets the list of summary items and the field on which summary is done. + SummaryCollection *SummaryCollection `json:"summaryCollection,omitempty"` + + // Gets the list of move resources. + Value []*MoveResource `json:"value,omitempty"` + + // READ-ONLY; Gets the total count. + TotalCount *int64 `json:"totalCount,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MoveResourceCollection. +func (m MoveResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "summaryCollection", m.SummaryCollection) + populate(objectMap, "totalCount", m.TotalCount) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// MoveResourceDependency - Defines the dependency of the move resource. +type MoveResourceDependency struct { + // Defines the properties for automatic resolution. + AutomaticResolution *AutomaticResolutionProperties `json:"automaticResolution,omitempty"` + + // Defines the dependency type. + DependencyType *DependencyType `json:"dependencyType,omitempty"` + + // Gets the source ARM ID of the dependent resource. + ID *string `json:"id,omitempty"` + + // Gets or sets a value indicating whether the dependency is optional. + IsOptional *string `json:"isOptional,omitempty"` + + // Defines the properties for manual resolution. + ManualResolution *ManualResolutionProperties `json:"manualResolution,omitempty"` + + // Gets the dependency resolution status. + ResolutionStatus *string `json:"resolutionStatus,omitempty"` + + // Defines the resolution type. + ResolutionType *ResolutionType `json:"resolutionType,omitempty"` +} + +// MoveResourceDependencyOverride - Defines the dependency override of the move resource. +type MoveResourceDependencyOverride struct { + // Gets or sets the ARM ID of the dependent resource. + ID *string `json:"id,omitempty"` + + // Gets or sets the resource ARM id of either the MoveResource or the resource ARM ID of the dependent resource. + TargetID *string `json:"targetId,omitempty"` +} + +// MoveResourceError - An error response from the azure resource mover service. +type MoveResourceError struct { + // The move resource error body. + Properties *MoveResourceErrorBody `json:"properties,omitempty"` +} + +// MoveResourceErrorBody - An error response from the Azure Migrate service. +type MoveResourceErrorBody struct { + // READ-ONLY; An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; A list of additional details about the error. + Details []*MoveResourceErrorBody `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MoveResourceErrorBody. +func (m MoveResourceErrorBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "code", m.Code) + populate(objectMap, "details", m.Details) + populate(objectMap, "message", m.Message) + populate(objectMap, "target", m.Target) + return json.Marshal(objectMap) +} + +// MoveResourceFilter - Move resource filter. +type MoveResourceFilter struct { + Properties *MoveResourceFilterProperties `json:"properties,omitempty"` +} + +type MoveResourceFilterProperties struct { + // The provisioning state. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// MoveResourceProperties - Defines the move resource properties. +type MoveResourceProperties struct { + // REQUIRED; Gets or sets the Source ARM Id of the resource. + SourceID *string `json:"sourceId,omitempty"` + + // Gets or sets the move resource dependencies overrides. + DependsOnOverrides []*MoveResourceDependencyOverride `json:"dependsOnOverrides,omitempty"` + + // Gets or sets the existing target ARM Id of the resource. + ExistingTargetID *string `json:"existingTargetId,omitempty"` + + // Gets or sets the resource settings. + ResourceSettings ResourceSettingsClassification `json:"resourceSettings,omitempty"` + + // READ-ONLY; Gets or sets the move resource dependencies. + DependsOn []*MoveResourceDependency `json:"dependsOn,omitempty" azure:"ro"` + + // READ-ONLY; Defines the move resource errors. + Errors *MoveResourcePropertiesErrors `json:"errors,omitempty" azure:"ro"` + + // READ-ONLY; Gets a value indicating whether the resolve action is required over the move collection. + IsResolveRequired *bool `json:"isResolveRequired,omitempty" azure:"ro"` + + // READ-ONLY; Defines the move resource status. + MoveStatus *MoveResourcePropertiesMoveStatus `json:"moveStatus,omitempty" azure:"ro"` + + // READ-ONLY; Defines the provisioning states. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Gets or sets the source resource settings. + SourceResourceSettings ResourceSettingsClassification `json:"sourceResourceSettings,omitempty" azure:"ro"` + + // READ-ONLY; Gets or sets the Target ARM Id of the resource. + TargetID *string `json:"targetId,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type MoveResourceProperties. +func (m MoveResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dependsOn", m.DependsOn) + populate(objectMap, "dependsOnOverrides", m.DependsOnOverrides) + populate(objectMap, "errors", m.Errors) + populate(objectMap, "existingTargetId", m.ExistingTargetID) + populate(objectMap, "isResolveRequired", m.IsResolveRequired) + populate(objectMap, "moveStatus", m.MoveStatus) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "resourceSettings", m.ResourceSettings) + populate(objectMap, "sourceId", m.SourceID) + populate(objectMap, "sourceResourceSettings", m.SourceResourceSettings) + populate(objectMap, "targetId", m.TargetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MoveResourceProperties. +func (m *MoveResourceProperties) 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 "dependsOn": + err = unpopulate(val, &m.DependsOn) + delete(rawMsg, key) + case "dependsOnOverrides": + err = unpopulate(val, &m.DependsOnOverrides) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, &m.Errors) + delete(rawMsg, key) + case "existingTargetId": + err = unpopulate(val, &m.ExistingTargetID) + delete(rawMsg, key) + case "isResolveRequired": + err = unpopulate(val, &m.IsResolveRequired) + delete(rawMsg, key) + case "moveStatus": + err = unpopulate(val, &m.MoveStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &m.ProvisioningState) + delete(rawMsg, key) + case "resourceSettings": + m.ResourceSettings, err = unmarshalResourceSettingsClassification(val) + delete(rawMsg, key) + case "sourceId": + err = unpopulate(val, &m.SourceID) + delete(rawMsg, key) + case "sourceResourceSettings": + m.SourceResourceSettings, err = unmarshalResourceSettingsClassification(val) + delete(rawMsg, key) + case "targetId": + err = unpopulate(val, &m.TargetID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MoveResourcePropertiesErrors - Defines the move resource errors. +type MoveResourcePropertiesErrors struct { + MoveResourceError +} + +// MoveResourcePropertiesMoveStatus - Defines the move resource status. +type MoveResourcePropertiesMoveStatus struct { + MoveResourceStatus +} + +// MoveResourceStatus - Defines the move resource status. +type MoveResourceStatus struct { + // An error response from the azure resource mover service. + Errors *MoveResourceError `json:"errors,omitempty"` + + // Defines the job status. + JobStatus *JobStatus `json:"jobStatus,omitempty"` + + // READ-ONLY; Defines the MoveResource states. + MoveState *MoveState `json:"moveState,omitempty" azure:"ro"` +} + +// MoveResourcesBeginCreateOptions contains the optional parameters for the MoveResources.BeginCreate method. +type MoveResourcesBeginCreateOptions struct { + Body *MoveResource +} + +// MoveResourcesBeginDeleteOptions contains the optional parameters for the MoveResources.BeginDelete method. +type MoveResourcesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// MoveResourcesGetOptions contains the optional parameters for the MoveResources.Get method. +type MoveResourcesGetOptions struct { + // placeholder for future optional parameters +} + +// MoveResourcesListOptions contains the optional parameters for the MoveResources.List method. +type MoveResourcesListOptions struct { + // The filter to apply on the operation. For example, you can use $filter=Properties/ProvisioningState eq 'Succeeded'. + Filter *string +} + +// NetworkInterfaceResourceSettings - Defines the network interface resource settings. +type NetworkInterfaceResourceSettings struct { + ResourceSettings + // Gets or sets a value indicating whether accelerated networking is enabled. + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + + // Gets or sets the IP configurations of the NIC. + IPConfigurations []*NicIPConfigurationResourceSettings `json:"ipConfigurations,omitempty"` + + // Gets or sets the Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkInterfaceResourceSettings. +func (n NetworkInterfaceResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + n.ResourceSettings.marshalInternal(objectMap, "Microsoft.Network/networkInterfaces") + populate(objectMap, "enableAcceleratedNetworking", n.EnableAcceleratedNetworking) + populate(objectMap, "ipConfigurations", n.IPConfigurations) + populate(objectMap, "tags", n.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkInterfaceResourceSettings. +func (n *NetworkInterfaceResourceSettings) 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 "enableAcceleratedNetworking": + err = unpopulate(val, &n.EnableAcceleratedNetworking) + delete(rawMsg, key) + case "ipConfigurations": + err = unpopulate(val, &n.IPConfigurations) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &n.Tags) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := n.ResourceSettings.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// NetworkSecurityGroupResourceSettings - Defines the NSG resource settings. +type NetworkSecurityGroupResourceSettings struct { + ResourceSettings + // Gets or sets Security rules of network security group. + SecurityRules []*NsgSecurityRule `json:"securityRules,omitempty"` + + // Gets or sets the Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkSecurityGroupResourceSettings. +func (n NetworkSecurityGroupResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + n.ResourceSettings.marshalInternal(objectMap, "Microsoft.Network/networkSecurityGroups") + populate(objectMap, "securityRules", n.SecurityRules) + populate(objectMap, "tags", n.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkSecurityGroupResourceSettings. +func (n *NetworkSecurityGroupResourceSettings) 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 "securityRules": + err = unpopulate(val, &n.SecurityRules) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &n.Tags) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := n.ResourceSettings.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// NicIPConfigurationResourceSettings - Defines NIC IP configuration properties. +type NicIPConfigurationResourceSettings struct { + // Gets or sets the references of the load balancer backend address pools. + LoadBalancerBackendAddressPools []*LoadBalancerBackendAddressPoolReference `json:"loadBalancerBackendAddressPools,omitempty"` + + // Gets or sets the references of the load balancer NAT rules. + LoadBalancerNatRules []*LoadBalancerNatRuleReference `json:"loadBalancerNatRules,omitempty"` + + // Gets or sets the IP configuration name. + Name *string `json:"name,omitempty"` + + // Gets or sets a value indicating whether this IP configuration is the primary. + Primary *bool `json:"primary,omitempty"` + + // Gets or sets the private IP address of the network interface IP Configuration. + PrivateIPAddress *string `json:"privateIpAddress,omitempty"` + + // Gets or sets the private IP address allocation method. + PrivateIPAllocationMethod *string `json:"privateIpAllocationMethod,omitempty"` + + // Defines reference to a public IP. + PublicIP *PublicIPReference `json:"publicIp,omitempty"` + + // Defines reference to subnet. + Subnet *SubnetReference `json:"subnet,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NicIPConfigurationResourceSettings. +func (n NicIPConfigurationResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "loadBalancerBackendAddressPools", n.LoadBalancerBackendAddressPools) + populate(objectMap, "loadBalancerNatRules", n.LoadBalancerNatRules) + populate(objectMap, "name", n.Name) + populate(objectMap, "primary", n.Primary) + populate(objectMap, "privateIpAddress", n.PrivateIPAddress) + populate(objectMap, "privateIpAllocationMethod", n.PrivateIPAllocationMethod) + populate(objectMap, "publicIp", n.PublicIP) + populate(objectMap, "subnet", n.Subnet) + return json.Marshal(objectMap) +} + +// NsgReference - Defines reference to NSG. +type NsgReference struct { + AzureResourceReference +} + +// NsgSecurityRule - Security Rule data model for Network Security Groups. +type NsgSecurityRule struct { + // Gets or sets whether network traffic is allowed or denied. Possible values are “Allow” and “Deny”. + Access *string `json:"access,omitempty"` + + // Gets or sets a description for this rule. Restricted to 140 chars. + Description *string `json:"description,omitempty"` + + // Gets or sets destination address prefix. CIDR or source IP range. A “*” can also be used to match all source IPs. Default tags such as ‘VirtualNetwork’, + // ‘AzureLoadBalancer’ and ‘Internet’ can also be + // used. + DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"` + + // Gets or sets Destination Port or Range. Integer or range between 0 and 65535. A “*” can also be used to match all ports. + DestinationPortRange *string `json:"destinationPortRange,omitempty"` + + // Gets or sets the direction of the rule.InBound or Outbound. The direction specifies if rule will be evaluated on incoming or outgoing traffic. + Direction *string `json:"direction,omitempty"` + + // Gets or sets the Security rule name. + Name *string `json:"name,omitempty"` + + // Gets or sets the priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule in the collection. The + // lower the priority number, the higher the priority + // of the rule. + Priority *int32 `json:"priority,omitempty"` + + // Gets or sets Network protocol this rule applies to. Can be Tcp, Udp or All(*). + Protocol *string `json:"protocol,omitempty"` + + // Gets or sets source address prefix. CIDR or source IP range. A “*” can also be used to match all source IPs. Default tags such as ‘VirtualNetwork’, ‘AzureLoadBalancer’ + // and ‘Internet’ can also be used. + // If this is an ingress rule, specifies where network traffic originates from. + SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"` + + // Gets or sets Source Port or Range. Integer or range between 0 and + // 65535. A “*” can also be used to match all ports. + SourcePortRange *string `json:"sourcePortRange,omitempty"` +} + +// OperationErrorAdditionalInfo - The operation error info. +type OperationErrorAdditionalInfo struct { + // READ-ONLY; The operation error info. + Info *MoveErrorInfo `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The error type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// OperationStatus - Operation status REST resource. +type OperationStatus struct { + // READ-ONLY; End time. + EndTime *string `json:"endTime,omitempty" azure:"ro"` + + // READ-ONLY; Error stating all error details for the operation. + Error *OperationStatusError `json:"error,omitempty" azure:"ro"` + + // READ-ONLY; Resource Id. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Operation name. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Custom data. + Properties map[string]interface{} `json:"properties,omitempty" azure:"ro"` + + // READ-ONLY; Start time. + StartTime *string `json:"startTime,omitempty" azure:"ro"` + + // READ-ONLY; Status of the operation. ARM expects the terminal status to be one of Succeeded/ Failed/ Canceled. All other values imply that the operation + // is still running. + Status *string `json:"status,omitempty" azure:"ro"` +} + +// OperationStatusError - Class for operation status errors. +type OperationStatusError struct { + // READ-ONLY; The additional info. + AdditionalInfo []*OperationErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*OperationStatusError `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type OperationStatusError. +func (o OperationStatusError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", o.AdditionalInfo) + populate(objectMap, "code", o.Code) + populate(objectMap, "details", o.Details) + populate(objectMap, "message", o.Message) + return json.Marshal(objectMap) +} + +// OperationsDiscovery - Operations discovery class. +type OperationsDiscovery struct { + // Contains the localized display information for this particular operation / action. These value will be used by several clients for (1) custom role definitions + // for RBAC; (2) complex query filters for + // the event service; and (3) audit history / records for management operations. + Display *Display `json:"display,omitempty"` + + // Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + + // Gets or sets Name of the API. The name of the operation being performed on this particular object. It should match the action name that appears in RBAC + // / the event service. Examples of operations + // include: + // * Microsoft.Compute/virtualMachine/capture/action + // * Microsoft.Compute/virtualMachine/restart/action + // * Microsoft.Compute/virtualMachine/write + // * Microsoft.Compute/virtualMachine/read + // * Microsoft.Compute/virtualMachine/delete Each action should include, in order: (1) Resource Provider Namespace (2) Type hierarchy for which the action + // applies (e.g. server/databases for a SQL Azure + // database) (3) Read, Write, Action or Delete indicating which type applies. If it is a PUT/PATCH on a collection or named value, Write should be used. + // If it is a GET, Read should be used. If it is a + // DELETE, Delete should be used. If it is a POST, Action should be used. As a note: all resource providers would need to include the "{Resource Provider + // Namespace}/register/action" operation in their + // response. This API is used to register for their service, and should include details about the operation (e.g. a localized name for the resource provider + // + any special considerations like PII + // release). + Name *string `json:"name,omitempty"` + + // Gets or sets Origin. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. Default value + // is "user,system". + Origin *string `json:"origin,omitempty"` + + // Any object + Properties map[string]interface{} `json:"properties,omitempty"` +} + +// OperationsDiscoveryCollection - Collection of ClientDiscovery details. +type OperationsDiscoveryCollection struct { + // Gets or sets the value of next link. + NextLink *string `json:"nextLink,omitempty"` + + // Gets or sets the ClientDiscovery details. + Value []*OperationsDiscovery `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type OperationsDiscoveryCollection. +func (o OperationsDiscoveryCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// OperationsDiscoveryGetOptions contains the optional parameters for the OperationsDiscovery.Get method. +type OperationsDiscoveryGetOptions struct { + // placeholder for future optional parameters +} + +// PrepareRequest - Defines the request body for initiate prepare operation. +type PrepareRequest struct { + // REQUIRED; Gets or sets the list of resource Id's, by default it accepts move resource id's unless the input type is switched via moveResourceInputType + // property. + MoveResources []*string `json:"moveResources,omitempty"` + + // Defines the move resource input type. + MoveResourceInputType *MoveResourceInputType `json:"moveResourceInputType,omitempty"` + + // Gets or sets a value indicating whether the operation needs to only run pre-requisite. + ValidateOnly *bool `json:"validateOnly,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PrepareRequest. +func (p PrepareRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "moveResourceInputType", p.MoveResourceInputType) + populate(objectMap, "moveResources", p.MoveResources) + populate(objectMap, "validateOnly", p.ValidateOnly) + return json.Marshal(objectMap) +} + +// ProxyResourceReference - Defines reference to a proxy resource. +type ProxyResourceReference struct { + AzureResourceReference + // Gets the name of the proxy resource on the target side. + Name *string `json:"name,omitempty"` +} + +// PublicIPAddressResourceSettings - Defines the public IP address resource settings. +type PublicIPAddressResourceSettings struct { + ResourceSettings + // Gets or sets the domain name label. + DomainNameLabel *string `json:"domainNameLabel,omitempty"` + + // Gets or sets the fully qualified domain name. + Fqdn *string `json:"fqdn,omitempty"` + + // Gets or sets public IP allocation method. + PublicIPAllocationMethod *string `json:"publicIpAllocationMethod,omitempty"` + + // Gets or sets public IP sku. + SKU *string `json:"sku,omitempty"` + + // Gets or sets the Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // Gets or sets public IP zones. + Zones *string `json:"zones,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type PublicIPAddressResourceSettings. +func (p PublicIPAddressResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + p.ResourceSettings.marshalInternal(objectMap, "Microsoft.Network/publicIPAddresses") + populate(objectMap, "domainNameLabel", p.DomainNameLabel) + populate(objectMap, "fqdn", p.Fqdn) + populate(objectMap, "publicIpAllocationMethod", p.PublicIPAllocationMethod) + populate(objectMap, "sku", p.SKU) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "zones", p.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicIPAddressResourceSettings. +func (p *PublicIPAddressResourceSettings) 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 "domainNameLabel": + err = unpopulate(val, &p.DomainNameLabel) + delete(rawMsg, key) + case "fqdn": + err = unpopulate(val, &p.Fqdn) + delete(rawMsg, key) + case "publicIpAllocationMethod": + err = unpopulate(val, &p.PublicIPAllocationMethod) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, &p.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &p.Tags) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, &p.Zones) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := p.ResourceSettings.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// PublicIPReference - Defines reference to a public IP. +type PublicIPReference struct { + AzureResourceReference +} + +// RequiredForResourcesCollection - Required for resources collection. +type RequiredForResourcesCollection struct { + // Gets or sets the list of source Ids for which the input resource is required. + SourceIDs []*string `json:"sourceIds,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RequiredForResourcesCollection. +func (r RequiredForResourcesCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sourceIds", r.SourceIDs) + return json.Marshal(objectMap) +} + +// ResourceGroupResourceSettings - Defines the resource group resource settings. +type ResourceGroupResourceSettings struct { + ResourceSettings +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceGroupResourceSettings. +func (r ResourceGroupResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.ResourceSettings.marshalInternal(objectMap, "resourceGroups") + return json.Marshal(objectMap) +} + +// ResourceMoveRequest - Defines the request body for resource move operation. +type ResourceMoveRequest struct { + // REQUIRED; Gets or sets the list of resource Id's, by default it accepts move resource id's unless the input type is switched via moveResourceInputType + // property. + MoveResources []*string `json:"moveResources,omitempty"` + + // Defines the move resource input type. + MoveResourceInputType *MoveResourceInputType `json:"moveResourceInputType,omitempty"` + + // Gets or sets a value indicating whether the operation needs to only run pre-requisite. + ValidateOnly *bool `json:"validateOnly,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ResourceMoveRequest. +func (r ResourceMoveRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "moveResourceInputType", r.MoveResourceInputType) + populate(objectMap, "moveResources", r.MoveResources) + populate(objectMap, "validateOnly", r.ValidateOnly) + return json.Marshal(objectMap) +} + +// ResourceSettingsClassification provides polymorphic access to related types. +// Call the interface's GetResourceSettings() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AvailabilitySetResourceSettings, *DiskEncryptionSetResourceSettings, *KeyVaultResourceSettings, *LoadBalancerResourceSettings, +// - *NetworkInterfaceResourceSettings, *NetworkSecurityGroupResourceSettings, *PublicIPAddressResourceSettings, *ResourceGroupResourceSettings, +// - *ResourceSettings, *SqlDatabaseResourceSettings, *SqlElasticPoolResourceSettings, *SqlServerResourceSettings, *VirtualMachineResourceSettings, +// - *VirtualNetworkResourceSettings +type ResourceSettingsClassification interface { + // GetResourceSettings returns the ResourceSettings content of the underlying type. + GetResourceSettings() *ResourceSettings +} + +// ResourceSettings - Gets or sets the resource settings. +type ResourceSettings struct { + // REQUIRED; The resource type. For example, the value can be Microsoft.Compute/virtualMachines. + ResourceType *string `json:"resourceType,omitempty"` + + // REQUIRED; Gets or sets the target Resource name. + TargetResourceName *string `json:"targetResourceName,omitempty"` +} + +// GetResourceSettings implements the ResourceSettingsClassification interface for type ResourceSettings. +func (r *ResourceSettings) GetResourceSettings() *ResourceSettings { return r } + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceSettings. +func (r *ResourceSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return r.unmarshalInternal(rawMsg) +} + +func (r ResourceSettings) marshalInternal(objectMap map[string]interface{}, discValue string) { + r.ResourceType = &discValue + objectMap["resourceType"] = r.ResourceType + populate(objectMap, "targetResourceName", r.TargetResourceName) +} + +func (r *ResourceSettings) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "resourceType": + err = unpopulate(val, &r.ResourceType) + delete(rawMsg, key) + case "targetResourceName": + err = unpopulate(val, &r.TargetResourceName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// SQLDatabaseResourceSettings - Defines the Sql Database resource settings. +type SQLDatabaseResourceSettings struct { + ResourceSettings + // Gets or sets the Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // Defines the zone redundant resource setting. + ZoneRedundant *ZoneRedundant `json:"zoneRedundant,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDatabaseResourceSettings. +func (s SQLDatabaseResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ResourceSettings.marshalInternal(objectMap, "Microsoft.Sql/servers/databases") + populate(objectMap, "tags", s.Tags) + populate(objectMap, "zoneRedundant", s.ZoneRedundant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDatabaseResourceSettings. +func (s *SQLDatabaseResourceSettings) 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 "tags": + err = unpopulate(val, &s.Tags) + delete(rawMsg, key) + case "zoneRedundant": + err = unpopulate(val, &s.ZoneRedundant) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.ResourceSettings.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// SQLElasticPoolResourceSettings - Defines the Sql ElasticPool resource settings. +type SQLElasticPoolResourceSettings struct { + ResourceSettings + // Gets or sets the Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // Defines the zone redundant resource setting. + ZoneRedundant *ZoneRedundant `json:"zoneRedundant,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SQLElasticPoolResourceSettings. +func (s SQLElasticPoolResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ResourceSettings.marshalInternal(objectMap, "Microsoft.Sql/servers/elasticPools") + populate(objectMap, "tags", s.Tags) + populate(objectMap, "zoneRedundant", s.ZoneRedundant) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLElasticPoolResourceSettings. +func (s *SQLElasticPoolResourceSettings) 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 "tags": + err = unpopulate(val, &s.Tags) + delete(rawMsg, key) + case "zoneRedundant": + err = unpopulate(val, &s.ZoneRedundant) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.ResourceSettings.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// SQLServerResourceSettings - Defines the SQL Server resource settings. +type SQLServerResourceSettings struct { + ResourceSettings +} + +// MarshalJSON implements the json.Marshaller interface for type SQLServerResourceSettings. +func (s SQLServerResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ResourceSettings.marshalInternal(objectMap, "Microsoft.Sql/servers") + return json.Marshal(objectMap) +} + +// SubnetReference - Defines reference to subnet. +type SubnetReference struct { + ProxyResourceReference +} + +// SubnetResourceSettings - Defines the virtual network subnets resource settings. +type SubnetResourceSettings struct { + // Gets or sets address prefix for the subnet. + AddressPrefix *string `json:"addressPrefix,omitempty"` + + // Gets or sets the Subnet name. + Name *string `json:"name,omitempty"` + + // Defines reference to NSG. + NetworkSecurityGroup *NsgReference `json:"networkSecurityGroup,omitempty"` +} + +// Summary item. +type Summary struct { + // Gets the count. + Count *int32 `json:"count,omitempty"` + + // Gets the item. + Item *string `json:"item,omitempty"` +} + +// SummaryCollection - Summary Collection. +type SummaryCollection struct { + // Gets or sets the field name on which summary is done. + FieldName *string `json:"fieldName,omitempty"` + + // Gets or sets the list of summary items. + Summary []*Summary `json:"summary,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SummaryCollection. +func (s SummaryCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "fieldName", s.FieldName) + populate(objectMap, "summary", s.Summary) + return json.Marshal(objectMap) +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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 "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// UnresolvedDependenciesFilter - Unresolved dependencies contract. +type UnresolvedDependenciesFilter struct { + Properties *UnresolvedDependenciesFilterProperties `json:"properties,omitempty"` +} + +type UnresolvedDependenciesFilterProperties struct { + // The count of the resource. + Count *int32 `json:"count,omitempty"` +} + +// UnresolvedDependenciesGetOptions contains the optional parameters for the UnresolvedDependencies.Get method. +type UnresolvedDependenciesGetOptions struct { + // Defines the dependency level. + DependencyLevel *DependencyLevel + // The filter to apply on the operation. For example, $apply=filter(count eq 2). + Filter *string + // OData order by query option. For example, you can use $orderby=Count desc. + Orderby *string +} + +// UnresolvedDependency - Unresolved dependency. +type UnresolvedDependency struct { + // Gets or sets the count. + Count *int32 `json:"count,omitempty"` + + // Gets or sets the arm id of the dependency. + ID *string `json:"id,omitempty"` +} + +// UnresolvedDependencyCollection - Unresolved dependency collection. +type UnresolvedDependencyCollection struct { + // Gets or sets the value of next link. + NextLink *string `json:"nextLink,omitempty"` + + // Gets or sets the list of unresolved dependencies. + Value []*UnresolvedDependency `json:"value,omitempty"` + + // READ-ONLY; Gets or sets the list of summary items and the field on which summary is done. + SummaryCollection *SummaryCollection `json:"summaryCollection,omitempty" azure:"ro"` + + // READ-ONLY; Gets the total count. + TotalCount *int64 `json:"totalCount,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type UnresolvedDependencyCollection. +func (u UnresolvedDependencyCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", u.NextLink) + populate(objectMap, "summaryCollection", u.SummaryCollection) + populate(objectMap, "totalCount", u.TotalCount) + populate(objectMap, "value", u.Value) + return json.Marshal(objectMap) +} + +// UpdateMoveCollectionRequest - Defines the request body for updating move collection. +type UpdateMoveCollectionRequest struct { + // Defines the MSI properties of the Move Collection. + Identity *Identity `json:"identity,omitempty"` + + // Gets or sets the Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateMoveCollectionRequest. +func (u UpdateMoveCollectionRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "identity", u.Identity) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// VirtualMachineResourceSettings - Gets or sets the virtual machine resource settings. +type VirtualMachineResourceSettings struct { + ResourceSettings + // Gets or sets the Resource tags. + Tags map[string]*string `json:"tags,omitempty"` + + // Gets or sets the target availability set id for virtual machines not in an availability set at source. + TargetAvailabilitySetID *string `json:"targetAvailabilitySetId,omitempty"` + + // Gets or sets the target availability zone. + TargetAvailabilityZone *TargetAvailabilityZone `json:"targetAvailabilityZone,omitempty"` + + // Gets or sets the target virtual machine size. + TargetVMSize *string `json:"targetVmSize,omitempty"` + + // Gets or sets user-managed identities + UserManagedIdentities []*string `json:"userManagedIdentities,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualMachineResourceSettings. +func (v VirtualMachineResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + v.ResourceSettings.marshalInternal(objectMap, "Microsoft.Compute/virtualMachines") + populate(objectMap, "tags", v.Tags) + populate(objectMap, "targetAvailabilitySetId", v.TargetAvailabilitySetID) + populate(objectMap, "targetAvailabilityZone", v.TargetAvailabilityZone) + populate(objectMap, "targetVmSize", v.TargetVMSize) + populate(objectMap, "userManagedIdentities", v.UserManagedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualMachineResourceSettings. +func (v *VirtualMachineResourceSettings) 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 "tags": + err = unpopulate(val, &v.Tags) + delete(rawMsg, key) + case "targetAvailabilitySetId": + err = unpopulate(val, &v.TargetAvailabilitySetID) + delete(rawMsg, key) + case "targetAvailabilityZone": + err = unpopulate(val, &v.TargetAvailabilityZone) + delete(rawMsg, key) + case "targetVmSize": + err = unpopulate(val, &v.TargetVMSize) + delete(rawMsg, key) + case "userManagedIdentities": + err = unpopulate(val, &v.UserManagedIdentities) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := v.ResourceSettings.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// VirtualNetworkResourceSettings - Defines the virtual network resource settings. +type VirtualNetworkResourceSettings struct { + ResourceSettings + // Gets or sets the address prefixes for the virtual network. + AddressSpace []*string `json:"addressSpace,omitempty"` + + // Gets or sets DHCPOptions that contains an array of DNS servers available to VMs deployed in the virtual network. + DNSServers []*string `json:"dnsServers,omitempty"` + + // Gets or sets a value indicating whether gets or sets whether the DDOS protection should be switched on. + EnableDdosProtection *bool `json:"enableDdosProtection,omitempty"` + + // Gets or sets List of subnets in a VirtualNetwork. + Subnets []*SubnetResourceSettings `json:"subnets,omitempty"` + + // Gets or sets the Resource tags. + Tags map[string]*string `json:"tags,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type VirtualNetworkResourceSettings. +func (v VirtualNetworkResourceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + v.ResourceSettings.marshalInternal(objectMap, "Microsoft.Network/virtualNetworks") + populate(objectMap, "addressSpace", v.AddressSpace) + populate(objectMap, "dnsServers", v.DNSServers) + populate(objectMap, "enableDdosProtection", v.EnableDdosProtection) + populate(objectMap, "subnets", v.Subnets) + populate(objectMap, "tags", v.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VirtualNetworkResourceSettings. +func (v *VirtualNetworkResourceSettings) 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 "addressSpace": + err = unpopulate(val, &v.AddressSpace) + delete(rawMsg, key) + case "dnsServers": + err = unpopulate(val, &v.DNSServers) + delete(rawMsg, key) + case "enableDdosProtection": + err = unpopulate(val, &v.EnableDdosProtection) + delete(rawMsg, key) + case "subnets": + err = unpopulate(val, &v.Subnets) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &v.Tags) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := v.ResourceSettings.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, v interface{}) error { + if data == nil { + return nil + } + return json.Unmarshal(data, v) +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_movecollections_client.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_movecollections_client.go new file mode 100644 index 000000000000..688d975545c1 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_movecollections_client.go @@ -0,0 +1,997 @@ +//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 armresourcemover + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "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" + "net/http" + "net/url" + "strings" +) + +// MoveCollectionsClient contains the methods for the MoveCollections group. +// Don't use this type directly, use NewMoveCollectionsClient() instead. +type MoveCollectionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewMoveCollectionsClient creates a new instance of MoveCollectionsClient with the specified values. +func NewMoveCollectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MoveCollectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MoveCollectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginBulkRemove - Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the +// user to prerequisite the operation the client can call operation +// with validateOnly property set to true. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) BeginBulkRemove(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginBulkRemoveOptions) (MoveCollectionsBulkRemovePollerResponse, error) { + resp, err := client.bulkRemove(ctx, resourceGroupName, moveCollectionName, options) + if err != nil { + return MoveCollectionsBulkRemovePollerResponse{}, err + } + result := MoveCollectionsBulkRemovePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MoveCollectionsClient.BulkRemove", "azure-async-operation", resp, client.pl, client.bulkRemoveHandleError) + if err != nil { + return MoveCollectionsBulkRemovePollerResponse{}, err + } + result.Poller = &MoveCollectionsBulkRemovePoller{ + pt: pt, + } + return result, nil +} + +// BulkRemove - Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the user +// to prerequisite the operation the client can call operation +// with validateOnly property set to true. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) bulkRemove(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginBulkRemoveOptions) (*http.Response, error) { + req, err := client.bulkRemoveCreateRequest(ctx, resourceGroupName, moveCollectionName, 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.bulkRemoveHandleError(resp) + } + return resp, nil +} + +// bulkRemoveCreateRequest creates the BulkRemove request. +func (client *MoveCollectionsClient) bulkRemoveCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginBulkRemoveOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/bulkRemove" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// bulkRemoveHandleError handles the BulkRemove error response. +func (client *MoveCollectionsClient) bulkRemoveHandleError(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) +} + +// BeginCommit - Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' +// or 'CommitFailed', on a successful completion the +// moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property +// set to true. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) BeginCommit(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginCommitOptions) (MoveCollectionsCommitPollerResponse, error) { + resp, err := client.commit(ctx, resourceGroupName, moveCollectionName, options) + if err != nil { + return MoveCollectionsCommitPollerResponse{}, err + } + result := MoveCollectionsCommitPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MoveCollectionsClient.Commit", "azure-async-operation", resp, client.pl, client.commitHandleError) + if err != nil { + return MoveCollectionsCommitPollerResponse{}, err + } + result.Poller = &MoveCollectionsCommitPoller{ + pt: pt, + } + return result, nil +} + +// Commit - Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' +// or 'CommitFailed', on a successful completion the +// moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property +// set to true. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) commit(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginCommitOptions) (*http.Response, error) { + req, err := client.commitCreateRequest(ctx, resourceGroupName, moveCollectionName, 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.commitHandleError(resp) + } + return resp, nil +} + +// commitCreateRequest creates the Commit request. +func (client *MoveCollectionsClient) commitCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginCommitOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/commit" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// commitHandleError handles the Commit error response. +func (client *MoveCollectionsClient) commitHandleError(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) +} + +// Create - Creates or updates a move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) Create(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsCreateOptions) (MoveCollectionsCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, moveCollectionName, options) + if err != nil { + return MoveCollectionsCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MoveCollectionsCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return MoveCollectionsCreateResponse{}, client.createHandleError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *MoveCollectionsClient) createCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *MoveCollectionsClient) createHandleResponse(resp *http.Response) (MoveCollectionsCreateResponse, error) { + result := MoveCollectionsCreateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MoveCollection); err != nil { + return MoveCollectionsCreateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// createHandleError handles the Create error response. +func (client *MoveCollectionsClient) createHandleError(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 - Deletes a move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginDeleteOptions) (MoveCollectionsDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, moveCollectionName, options) + if err != nil { + return MoveCollectionsDeletePollerResponse{}, err + } + result := MoveCollectionsDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MoveCollectionsClient.Delete", "azure-async-operation", resp, client.pl, client.deleteHandleError) + if err != nil { + return MoveCollectionsDeletePollerResponse{}, err + } + result.Poller = &MoveCollectionsDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, moveCollectionName, 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 *MoveCollectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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-08-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 *MoveCollectionsClient) 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) +} + +// BeginDiscard - Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' +// or 'DiscardFailed', on a successful completion the +// moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly +// property set to true. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) BeginDiscard(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginDiscardOptions) (MoveCollectionsDiscardPollerResponse, error) { + resp, err := client.discard(ctx, resourceGroupName, moveCollectionName, options) + if err != nil { + return MoveCollectionsDiscardPollerResponse{}, err + } + result := MoveCollectionsDiscardPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MoveCollectionsClient.Discard", "azure-async-operation", resp, client.pl, client.discardHandleError) + if err != nil { + return MoveCollectionsDiscardPollerResponse{}, err + } + result.Poller = &MoveCollectionsDiscardPoller{ + pt: pt, + } + return result, nil +} + +// Discard - Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' +// or 'DiscardFailed', on a successful completion the +// moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly +// property set to true. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) discard(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginDiscardOptions) (*http.Response, error) { + req, err := client.discardCreateRequest(ctx, resourceGroupName, moveCollectionName, 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.discardHandleError(resp) + } + return resp, nil +} + +// discardCreateRequest creates the Discard request. +func (client *MoveCollectionsClient) discardCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginDiscardOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/discard" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// discardHandleError handles the Discard error response. +func (client *MoveCollectionsClient) discardHandleError(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 - Gets the move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) Get(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsGetOptions) (MoveCollectionsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, moveCollectionName, options) + if err != nil { + return MoveCollectionsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MoveCollectionsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MoveCollectionsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *MoveCollectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MoveCollectionsClient) getHandleResponse(resp *http.Response) (MoveCollectionsGetResponse, error) { + result := MoveCollectionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MoveCollection); err != nil { + return MoveCollectionsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *MoveCollectionsClient) 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) +} + +// BeginInitiateMove - Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState +// 'MovePending' or 'MoveFailed', on a successful completion the +// moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly +// property set to true. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) BeginInitiateMove(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginInitiateMoveOptions) (MoveCollectionsInitiateMovePollerResponse, error) { + resp, err := client.initiateMove(ctx, resourceGroupName, moveCollectionName, options) + if err != nil { + return MoveCollectionsInitiateMovePollerResponse{}, err + } + result := MoveCollectionsInitiateMovePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MoveCollectionsClient.InitiateMove", "azure-async-operation", resp, client.pl, client.initiateMoveHandleError) + if err != nil { + return MoveCollectionsInitiateMovePollerResponse{}, err + } + result.Poller = &MoveCollectionsInitiateMovePoller{ + pt: pt, + } + return result, nil +} + +// InitiateMove - Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState +// 'MovePending' or 'MoveFailed', on a successful completion the +// moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly +// property set to true. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) initiateMove(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginInitiateMoveOptions) (*http.Response, error) { + req, err := client.initiateMoveCreateRequest(ctx, resourceGroupName, moveCollectionName, 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.initiateMoveHandleError(resp) + } + return resp, nil +} + +// initiateMoveCreateRequest creates the InitiateMove request. +func (client *MoveCollectionsClient) initiateMoveCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginInitiateMoveOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/initiateMove" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// initiateMoveHandleError handles the InitiateMove error response. +func (client *MoveCollectionsClient) initiateMoveHandleError(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) +} + +// ListMoveCollectionsByResourceGroup - Get all the Move Collections in the resource group. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) ListMoveCollectionsByResourceGroup(resourceGroupName string, options *MoveCollectionsListMoveCollectionsByResourceGroupOptions) *MoveCollectionsListMoveCollectionsByResourceGroupPager { + return &MoveCollectionsListMoveCollectionsByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listMoveCollectionsByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp MoveCollectionsListMoveCollectionsByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.MoveCollectionResultList.NextLink) + }, + } +} + +// listMoveCollectionsByResourceGroupCreateRequest creates the ListMoveCollectionsByResourceGroup request. +func (client *MoveCollectionsClient) listMoveCollectionsByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *MoveCollectionsListMoveCollectionsByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections" + 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)) + 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-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listMoveCollectionsByResourceGroupHandleResponse handles the ListMoveCollectionsByResourceGroup response. +func (client *MoveCollectionsClient) listMoveCollectionsByResourceGroupHandleResponse(resp *http.Response) (MoveCollectionsListMoveCollectionsByResourceGroupResponse, error) { + result := MoveCollectionsListMoveCollectionsByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MoveCollectionResultList); err != nil { + return MoveCollectionsListMoveCollectionsByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listMoveCollectionsByResourceGroupHandleError handles the ListMoveCollectionsByResourceGroup error response. +func (client *MoveCollectionsClient) listMoveCollectionsByResourceGroupHandleError(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) +} + +// ListMoveCollectionsBySubscription - Get all the Move Collections in the subscription. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) ListMoveCollectionsBySubscription(options *MoveCollectionsListMoveCollectionsBySubscriptionOptions) *MoveCollectionsListMoveCollectionsBySubscriptionPager { + return &MoveCollectionsListMoveCollectionsBySubscriptionPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listMoveCollectionsBySubscriptionCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp MoveCollectionsListMoveCollectionsBySubscriptionResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.MoveCollectionResultList.NextLink) + }, + } +} + +// listMoveCollectionsBySubscriptionCreateRequest creates the ListMoveCollectionsBySubscription request. +func (client *MoveCollectionsClient) listMoveCollectionsBySubscriptionCreateRequest(ctx context.Context, options *MoveCollectionsListMoveCollectionsBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Migrate/moveCollections" + 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-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listMoveCollectionsBySubscriptionHandleResponse handles the ListMoveCollectionsBySubscription response. +func (client *MoveCollectionsClient) listMoveCollectionsBySubscriptionHandleResponse(resp *http.Response) (MoveCollectionsListMoveCollectionsBySubscriptionResponse, error) { + result := MoveCollectionsListMoveCollectionsBySubscriptionResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MoveCollectionResultList); err != nil { + return MoveCollectionsListMoveCollectionsBySubscriptionResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listMoveCollectionsBySubscriptionHandleError handles the ListMoveCollectionsBySubscription error response. +func (client *MoveCollectionsClient) listMoveCollectionsBySubscriptionHandleError(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) +} + +// ListRequiredFor - List of the move resources for which an arm resource is required for. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) ListRequiredFor(ctx context.Context, resourceGroupName string, moveCollectionName string, sourceID string, options *MoveCollectionsListRequiredForOptions) (MoveCollectionsListRequiredForResponse, error) { + req, err := client.listRequiredForCreateRequest(ctx, resourceGroupName, moveCollectionName, sourceID, options) + if err != nil { + return MoveCollectionsListRequiredForResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MoveCollectionsListRequiredForResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MoveCollectionsListRequiredForResponse{}, client.listRequiredForHandleError(resp) + } + return client.listRequiredForHandleResponse(resp) +} + +// listRequiredForCreateRequest creates the ListRequiredFor request. +func (client *MoveCollectionsClient) listRequiredForCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, sourceID string, options *MoveCollectionsListRequiredForOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/requiredFor" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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("sourceId", sourceID) + reqQP.Set("api-version", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listRequiredForHandleResponse handles the ListRequiredFor response. +func (client *MoveCollectionsClient) listRequiredForHandleResponse(resp *http.Response) (MoveCollectionsListRequiredForResponse, error) { + result := MoveCollectionsListRequiredForResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RequiredForResourcesCollection); err != nil { + return MoveCollectionsListRequiredForResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listRequiredForHandleError handles the ListRequiredFor error response. +func (client *MoveCollectionsClient) listRequiredForHandleError(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) +} + +// BeginPrepare - Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the +// moveState 'PreparePending' or 'PrepareFailed', on a successful +// completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with +// validateOnly property set to true. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) BeginPrepare(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginPrepareOptions) (MoveCollectionsPreparePollerResponse, error) { + resp, err := client.prepare(ctx, resourceGroupName, moveCollectionName, options) + if err != nil { + return MoveCollectionsPreparePollerResponse{}, err + } + result := MoveCollectionsPreparePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MoveCollectionsClient.Prepare", "azure-async-operation", resp, client.pl, client.prepareHandleError) + if err != nil { + return MoveCollectionsPreparePollerResponse{}, err + } + result.Poller = &MoveCollectionsPreparePoller{ + pt: pt, + } + return result, nil +} + +// Prepare - Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the moveState +// 'PreparePending' or 'PrepareFailed', on a successful +// completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with +// validateOnly property set to true. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) prepare(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginPrepareOptions) (*http.Response, error) { + req, err := client.prepareCreateRequest(ctx, resourceGroupName, moveCollectionName, 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.prepareHandleError(resp) + } + return resp, nil +} + +// prepareCreateRequest creates the Prepare request. +func (client *MoveCollectionsClient) prepareCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginPrepareOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/prepare" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// prepareHandleError handles the Prepare error response. +func (client *MoveCollectionsClient) prepareHandleError(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) +} + +// BeginResolveDependencies - Computes, resolves and validate the dependencies of the moveResources in the move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) BeginResolveDependencies(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginResolveDependenciesOptions) (MoveCollectionsResolveDependenciesPollerResponse, error) { + resp, err := client.resolveDependencies(ctx, resourceGroupName, moveCollectionName, options) + if err != nil { + return MoveCollectionsResolveDependenciesPollerResponse{}, err + } + result := MoveCollectionsResolveDependenciesPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MoveCollectionsClient.ResolveDependencies", "azure-async-operation", resp, client.pl, client.resolveDependenciesHandleError) + if err != nil { + return MoveCollectionsResolveDependenciesPollerResponse{}, err + } + result.Poller = &MoveCollectionsResolveDependenciesPoller{ + pt: pt, + } + return result, nil +} + +// ResolveDependencies - Computes, resolves and validate the dependencies of the moveResources in the move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) resolveDependencies(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginResolveDependenciesOptions) (*http.Response, error) { + req, err := client.resolveDependenciesCreateRequest(ctx, resourceGroupName, moveCollectionName, 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.resolveDependenciesHandleError(resp) + } + return resp, nil +} + +// resolveDependenciesCreateRequest creates the ResolveDependencies request. +func (client *MoveCollectionsClient) resolveDependenciesCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsBeginResolveDependenciesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/resolveDependencies" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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", "2021-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// resolveDependenciesHandleError handles the ResolveDependencies error response. +func (client *MoveCollectionsClient) resolveDependenciesHandleError(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 - Updates a move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveCollectionsClient) Update(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsUpdateOptions) (MoveCollectionsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, moveCollectionName, options) + if err != nil { + return MoveCollectionsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MoveCollectionsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MoveCollectionsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *MoveCollectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveCollectionsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *MoveCollectionsClient) updateHandleResponse(resp *http.Response) (MoveCollectionsUpdateResponse, error) { + result := MoveCollectionsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MoveCollection); err != nil { + return MoveCollectionsUpdateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *MoveCollectionsClient) 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/resourcemanager/resourcemover/armresourcemover/zz_generated_moveresources_client.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_moveresources_client.go new file mode 100644 index 000000000000..4910e4fe0e90 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_moveresources_client.go @@ -0,0 +1,340 @@ +//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 armresourcemover + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "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" + "net/http" + "net/url" + "strings" +) + +// MoveResourcesClient contains the methods for the MoveResources group. +// Don't use this type directly, use NewMoveResourcesClient() instead. +type MoveResourcesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewMoveResourcesClient creates a new instance of MoveResourcesClient with the specified values. +func NewMoveResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MoveResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MoveResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreate - Creates or updates a Move Resource in the move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveResourcesClient) BeginCreate(ctx context.Context, resourceGroupName string, moveCollectionName string, moveResourceName string, options *MoveResourcesBeginCreateOptions) (MoveResourcesCreatePollerResponse, error) { + resp, err := client.create(ctx, resourceGroupName, moveCollectionName, moveResourceName, options) + if err != nil { + return MoveResourcesCreatePollerResponse{}, err + } + result := MoveResourcesCreatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MoveResourcesClient.Create", "azure-async-operation", resp, client.pl, client.createHandleError) + if err != nil { + return MoveResourcesCreatePollerResponse{}, err + } + result.Poller = &MoveResourcesCreatePoller{ + pt: pt, + } + return result, nil +} + +// Create - Creates or updates a Move Resource in the move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveResourcesClient) create(ctx context.Context, resourceGroupName string, moveCollectionName string, moveResourceName string, options *MoveResourcesBeginCreateOptions) (*http.Response, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, moveCollectionName, moveResourceName, 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.createHandleError(resp) + } + return resp, nil +} + +// createCreateRequest creates the Create request. +func (client *MoveResourcesClient) createCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, moveResourceName string, options *MoveResourcesBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + if moveResourceName == "" { + return nil, errors.New("parameter moveResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveResourceName}", url.PathEscape(moveResourceName)) + 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-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + if options != nil && options.Body != nil { + return req, runtime.MarshalAsJSON(req, *options.Body) + } + return req, nil +} + +// createHandleError handles the Create error response. +func (client *MoveResourcesClient) createHandleError(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 - Deletes a Move Resource from the move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveResourcesClient) BeginDelete(ctx context.Context, resourceGroupName string, moveCollectionName string, moveResourceName string, options *MoveResourcesBeginDeleteOptions) (MoveResourcesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, moveCollectionName, moveResourceName, options) + if err != nil { + return MoveResourcesDeletePollerResponse{}, err + } + result := MoveResourcesDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MoveResourcesClient.Delete", "azure-async-operation", resp, client.pl, client.deleteHandleError) + if err != nil { + return MoveResourcesDeletePollerResponse{}, err + } + result.Poller = &MoveResourcesDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a Move Resource from the move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, moveCollectionName string, moveResourceName string, options *MoveResourcesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, moveCollectionName, moveResourceName, 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 *MoveResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, moveResourceName string, options *MoveResourcesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + if moveResourceName == "" { + return nil, errors.New("parameter moveResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveResourceName}", url.PathEscape(moveResourceName)) + 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-08-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 *MoveResourcesClient) 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 - Gets the Move Resource. +// If the operation fails it returns the *CloudError error type. +func (client *MoveResourcesClient) Get(ctx context.Context, resourceGroupName string, moveCollectionName string, moveResourceName string, options *MoveResourcesGetOptions) (MoveResourcesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, moveCollectionName, moveResourceName, options) + if err != nil { + return MoveResourcesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MoveResourcesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MoveResourcesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *MoveResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, moveResourceName string, options *MoveResourcesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + if moveResourceName == "" { + return nil, errors.New("parameter moveResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveResourceName}", url.PathEscape(moveResourceName)) + 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-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MoveResourcesClient) getHandleResponse(resp *http.Response) (MoveResourcesGetResponse, error) { + result := MoveResourcesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MoveResource); err != nil { + return MoveResourcesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *MoveResourcesClient) 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) +} + +// List - Lists the Move Resources in the move collection. +// If the operation fails it returns the *CloudError error type. +func (client *MoveResourcesClient) List(resourceGroupName string, moveCollectionName string, options *MoveResourcesListOptions) *MoveResourcesListPager { + return &MoveResourcesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, moveCollectionName, options) + }, + advancer: func(ctx context.Context, resp MoveResourcesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.MoveResourceCollection.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *MoveResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *MoveResourcesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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-08-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MoveResourcesClient) listHandleResponse(resp *http.Response) (MoveResourcesListResponse, error) { + result := MoveResourcesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MoveResourceCollection); err != nil { + return MoveResourcesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *MoveResourcesClient) listHandleError(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/resourcemanager/resourcemover/armresourcemover/zz_generated_operationsdiscovery_client.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_operationsdiscovery_client.go new file mode 100644 index 000000000000..c7e18c9ae88a --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_operationsdiscovery_client.go @@ -0,0 +1,92 @@ +//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 armresourcemover + +import ( + "context" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "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" + "net/http" +) + +// OperationsDiscoveryClient contains the methods for the OperationsDiscovery group. +// Don't use this type directly, use NewOperationsDiscoveryClient() instead. +type OperationsDiscoveryClient struct { + ep string + pl runtime.Pipeline +} + +// NewOperationsDiscoveryClient creates a new instance of OperationsDiscoveryClient with the specified values. +func NewOperationsDiscoveryClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsDiscoveryClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsDiscoveryClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - +// If the operation fails it returns the *CloudError error type. +func (client *OperationsDiscoveryClient) Get(ctx context.Context, options *OperationsDiscoveryGetOptions) (OperationsDiscoveryGetResponse, error) { + req, err := client.getCreateRequest(ctx, options) + if err != nil { + return OperationsDiscoveryGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsDiscoveryGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsDiscoveryGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *OperationsDiscoveryClient) getCreateRequest(ctx context.Context, options *OperationsDiscoveryGetOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Migrate/operations" + 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-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OperationsDiscoveryClient) getHandleResponse(resp *http.Response) (OperationsDiscoveryGetResponse, error) { + result := OperationsDiscoveryGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationsDiscoveryCollection); err != nil { + return OperationsDiscoveryGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *OperationsDiscoveryClient) 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) +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_pagers.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_pagers.go new file mode 100644 index 000000000000..43bc4dbdbd09 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_pagers.go @@ -0,0 +1,233 @@ +//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 armresourcemover + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" +) + +// MoveCollectionsListMoveCollectionsByResourceGroupPager provides operations for iterating over paged responses. +type MoveCollectionsListMoveCollectionsByResourceGroupPager struct { + client *MoveCollectionsClient + current MoveCollectionsListMoveCollectionsByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, MoveCollectionsListMoveCollectionsByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *MoveCollectionsListMoveCollectionsByResourceGroupPager) 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 *MoveCollectionsListMoveCollectionsByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.MoveCollectionResultList.NextLink == nil || len(*p.current.MoveCollectionResultList.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.listMoveCollectionsByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listMoveCollectionsByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current MoveCollectionsListMoveCollectionsByResourceGroupResponse page. +func (p *MoveCollectionsListMoveCollectionsByResourceGroupPager) PageResponse() MoveCollectionsListMoveCollectionsByResourceGroupResponse { + return p.current +} + +// MoveCollectionsListMoveCollectionsBySubscriptionPager provides operations for iterating over paged responses. +type MoveCollectionsListMoveCollectionsBySubscriptionPager struct { + client *MoveCollectionsClient + current MoveCollectionsListMoveCollectionsBySubscriptionResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, MoveCollectionsListMoveCollectionsBySubscriptionResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *MoveCollectionsListMoveCollectionsBySubscriptionPager) 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 *MoveCollectionsListMoveCollectionsBySubscriptionPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.MoveCollectionResultList.NextLink == nil || len(*p.current.MoveCollectionResultList.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.listMoveCollectionsBySubscriptionHandleError(resp) + return false + } + result, err := p.client.listMoveCollectionsBySubscriptionHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current MoveCollectionsListMoveCollectionsBySubscriptionResponse page. +func (p *MoveCollectionsListMoveCollectionsBySubscriptionPager) PageResponse() MoveCollectionsListMoveCollectionsBySubscriptionResponse { + return p.current +} + +// MoveResourcesListPager provides operations for iterating over paged responses. +type MoveResourcesListPager struct { + client *MoveResourcesClient + current MoveResourcesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, MoveResourcesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *MoveResourcesListPager) 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 *MoveResourcesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.MoveResourceCollection.NextLink == nil || len(*p.current.MoveResourceCollection.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 MoveResourcesListResponse page. +func (p *MoveResourcesListPager) PageResponse() MoveResourcesListResponse { + return p.current +} + +// UnresolvedDependenciesGetPager provides operations for iterating over paged responses. +type UnresolvedDependenciesGetPager struct { + client *UnresolvedDependenciesClient + current UnresolvedDependenciesGetResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, UnresolvedDependenciesGetResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *UnresolvedDependenciesGetPager) 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 *UnresolvedDependenciesGetPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.UnresolvedDependencyCollection.NextLink == nil || len(*p.current.UnresolvedDependencyCollection.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.getHandleError(resp) + return false + } + result, err := p.client.getHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current UnresolvedDependenciesGetResponse page. +func (p *UnresolvedDependenciesGetPager) PageResponse() UnresolvedDependenciesGetResponse { + return p.current +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_pollers.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_pollers.go new file mode 100644 index 000000000000..de7bb844f420 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_pollers.go @@ -0,0 +1,402 @@ +//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 armresourcemover + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" +) + +// MoveCollectionsBulkRemovePoller provides polling facilities until the operation reaches a terminal state. +type MoveCollectionsBulkRemovePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MoveCollectionsBulkRemovePoller) 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 *MoveCollectionsBulkRemovePoller) 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 MoveCollectionsBulkRemoveResponse will be returned. +func (p *MoveCollectionsBulkRemovePoller) FinalResponse(ctx context.Context) (MoveCollectionsBulkRemoveResponse, error) { + respType := MoveCollectionsBulkRemoveResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.OperationStatus) + if err != nil { + return MoveCollectionsBulkRemoveResponse{}, 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 *MoveCollectionsBulkRemovePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// MoveCollectionsCommitPoller provides polling facilities until the operation reaches a terminal state. +type MoveCollectionsCommitPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MoveCollectionsCommitPoller) 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 *MoveCollectionsCommitPoller) 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 MoveCollectionsCommitResponse will be returned. +func (p *MoveCollectionsCommitPoller) FinalResponse(ctx context.Context) (MoveCollectionsCommitResponse, error) { + respType := MoveCollectionsCommitResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.OperationStatus) + if err != nil { + return MoveCollectionsCommitResponse{}, 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 *MoveCollectionsCommitPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// MoveCollectionsDeletePoller provides polling facilities until the operation reaches a terminal state. +type MoveCollectionsDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MoveCollectionsDeletePoller) 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 *MoveCollectionsDeletePoller) 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 MoveCollectionsDeleteResponse will be returned. +func (p *MoveCollectionsDeletePoller) FinalResponse(ctx context.Context) (MoveCollectionsDeleteResponse, error) { + respType := MoveCollectionsDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.OperationStatus) + if err != nil { + return MoveCollectionsDeleteResponse{}, 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 *MoveCollectionsDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// MoveCollectionsDiscardPoller provides polling facilities until the operation reaches a terminal state. +type MoveCollectionsDiscardPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MoveCollectionsDiscardPoller) 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 *MoveCollectionsDiscardPoller) 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 MoveCollectionsDiscardResponse will be returned. +func (p *MoveCollectionsDiscardPoller) FinalResponse(ctx context.Context) (MoveCollectionsDiscardResponse, error) { + respType := MoveCollectionsDiscardResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.OperationStatus) + if err != nil { + return MoveCollectionsDiscardResponse{}, 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 *MoveCollectionsDiscardPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// MoveCollectionsInitiateMovePoller provides polling facilities until the operation reaches a terminal state. +type MoveCollectionsInitiateMovePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MoveCollectionsInitiateMovePoller) 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 *MoveCollectionsInitiateMovePoller) 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 MoveCollectionsInitiateMoveResponse will be returned. +func (p *MoveCollectionsInitiateMovePoller) FinalResponse(ctx context.Context) (MoveCollectionsInitiateMoveResponse, error) { + respType := MoveCollectionsInitiateMoveResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.OperationStatus) + if err != nil { + return MoveCollectionsInitiateMoveResponse{}, 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 *MoveCollectionsInitiateMovePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// MoveCollectionsPreparePoller provides polling facilities until the operation reaches a terminal state. +type MoveCollectionsPreparePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MoveCollectionsPreparePoller) 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 *MoveCollectionsPreparePoller) 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 MoveCollectionsPrepareResponse will be returned. +func (p *MoveCollectionsPreparePoller) FinalResponse(ctx context.Context) (MoveCollectionsPrepareResponse, error) { + respType := MoveCollectionsPrepareResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.OperationStatus) + if err != nil { + return MoveCollectionsPrepareResponse{}, 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 *MoveCollectionsPreparePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// MoveCollectionsResolveDependenciesPoller provides polling facilities until the operation reaches a terminal state. +type MoveCollectionsResolveDependenciesPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MoveCollectionsResolveDependenciesPoller) 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 *MoveCollectionsResolveDependenciesPoller) 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 MoveCollectionsResolveDependenciesResponse will be returned. +func (p *MoveCollectionsResolveDependenciesPoller) FinalResponse(ctx context.Context) (MoveCollectionsResolveDependenciesResponse, error) { + respType := MoveCollectionsResolveDependenciesResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.OperationStatus) + if err != nil { + return MoveCollectionsResolveDependenciesResponse{}, 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 *MoveCollectionsResolveDependenciesPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// MoveResourcesCreatePoller provides polling facilities until the operation reaches a terminal state. +type MoveResourcesCreatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MoveResourcesCreatePoller) 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 *MoveResourcesCreatePoller) 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 MoveResourcesCreateResponse will be returned. +func (p *MoveResourcesCreatePoller) FinalResponse(ctx context.Context) (MoveResourcesCreateResponse, error) { + respType := MoveResourcesCreateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.MoveResource) + if err != nil { + return MoveResourcesCreateResponse{}, 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 *MoveResourcesCreatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// MoveResourcesDeletePoller provides polling facilities until the operation reaches a terminal state. +type MoveResourcesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MoveResourcesDeletePoller) 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 *MoveResourcesDeletePoller) 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 MoveResourcesDeleteResponse will be returned. +func (p *MoveResourcesDeletePoller) FinalResponse(ctx context.Context) (MoveResourcesDeleteResponse, error) { + respType := MoveResourcesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.OperationStatus) + if err != nil { + return MoveResourcesDeleteResponse{}, 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 *MoveResourcesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_polymorphic_helpers.go new file mode 100644 index 000000000000..b63d7f334c6c --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_polymorphic_helpers.go @@ -0,0 +1,91 @@ +//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 armresourcemover + +import "encoding/json" + +func unmarshalResourceSettingsClassification(rawMsg json.RawMessage) (ResourceSettingsClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ResourceSettingsClassification + switch m["resourceType"] { + case "Microsoft.Compute/availabilitySets": + b = &AvailabilitySetResourceSettings{} + case "Microsoft.Compute/diskEncryptionSets": + b = &DiskEncryptionSetResourceSettings{} + case "Microsoft.Compute/virtualMachines": + b = &VirtualMachineResourceSettings{} + case "Microsoft.KeyVault/vaults": + b = &KeyVaultResourceSettings{} + case "Microsoft.Network/loadBalancers": + b = &LoadBalancerResourceSettings{} + case "Microsoft.Network/networkInterfaces": + b = &NetworkInterfaceResourceSettings{} + case "Microsoft.Network/networkSecurityGroups": + b = &NetworkSecurityGroupResourceSettings{} + case "Microsoft.Network/publicIPAddresses": + b = &PublicIPAddressResourceSettings{} + case "Microsoft.Network/virtualNetworks": + b = &VirtualNetworkResourceSettings{} + case "Microsoft.Sql/servers": + b = &SQLServerResourceSettings{} + case "Microsoft.Sql/servers/databases": + b = &SQLDatabaseResourceSettings{} + case "Microsoft.Sql/servers/elasticPools": + b = &SQLElasticPoolResourceSettings{} + case "resourceGroups": + b = &ResourceGroupResourceSettings{} + default: + b = &ResourceSettings{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalResourceSettingsClassificationArray(rawMsg json.RawMessage) ([]ResourceSettingsClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]ResourceSettingsClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalResourceSettingsClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalResourceSettingsClassificationMap(rawMsg json.RawMessage) (map[string]ResourceSettingsClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ResourceSettingsClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalResourceSettingsClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_response_types.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_response_types.go new file mode 100644 index 000000000000..7a4049d70f0a --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_response_types.go @@ -0,0 +1,604 @@ +//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 armresourcemover + +import ( + "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "net/http" + "time" +) + +// MoveCollectionsBulkRemovePollerResponse contains the response from method MoveCollections.BulkRemove. +type MoveCollectionsBulkRemovePollerResponse struct { + // Poller contains an initialized poller. + Poller *MoveCollectionsBulkRemovePoller + + // 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. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MoveCollectionsBulkRemovePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MoveCollectionsBulkRemoveResponse, error) { + respType := MoveCollectionsBulkRemoveResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MoveCollectionsBulkRemovePollerResponse from the provided client and resume token. +func (l *MoveCollectionsBulkRemovePollerResponse) Resume(ctx context.Context, client *MoveCollectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MoveCollectionsClient.BulkRemove", token, client.pl, client.bulkRemoveHandleError) + if err != nil { + return err + } + poller := &MoveCollectionsBulkRemovePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MoveCollectionsBulkRemoveResponse contains the response from method MoveCollections.BulkRemove. +type MoveCollectionsBulkRemoveResponse struct { + MoveCollectionsBulkRemoveResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsBulkRemoveResult contains the result from method MoveCollections.BulkRemove. +type MoveCollectionsBulkRemoveResult struct { + OperationStatus +} + +// MoveCollectionsCommitPollerResponse contains the response from method MoveCollections.Commit. +type MoveCollectionsCommitPollerResponse struct { + // Poller contains an initialized poller. + Poller *MoveCollectionsCommitPoller + + // 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. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MoveCollectionsCommitPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MoveCollectionsCommitResponse, error) { + respType := MoveCollectionsCommitResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MoveCollectionsCommitPollerResponse from the provided client and resume token. +func (l *MoveCollectionsCommitPollerResponse) Resume(ctx context.Context, client *MoveCollectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MoveCollectionsClient.Commit", token, client.pl, client.commitHandleError) + if err != nil { + return err + } + poller := &MoveCollectionsCommitPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MoveCollectionsCommitResponse contains the response from method MoveCollections.Commit. +type MoveCollectionsCommitResponse struct { + MoveCollectionsCommitResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsCommitResult contains the result from method MoveCollections.Commit. +type MoveCollectionsCommitResult struct { + OperationStatus +} + +// MoveCollectionsCreateResponse contains the response from method MoveCollections.Create. +type MoveCollectionsCreateResponse struct { + MoveCollectionsCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsCreateResult contains the result from method MoveCollections.Create. +type MoveCollectionsCreateResult struct { + MoveCollection +} + +// MoveCollectionsDeletePollerResponse contains the response from method MoveCollections.Delete. +type MoveCollectionsDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *MoveCollectionsDeletePoller + + // 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. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MoveCollectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MoveCollectionsDeleteResponse, error) { + respType := MoveCollectionsDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MoveCollectionsDeletePollerResponse from the provided client and resume token. +func (l *MoveCollectionsDeletePollerResponse) Resume(ctx context.Context, client *MoveCollectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MoveCollectionsClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &MoveCollectionsDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MoveCollectionsDeleteResponse contains the response from method MoveCollections.Delete. +type MoveCollectionsDeleteResponse struct { + MoveCollectionsDeleteResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsDeleteResult contains the result from method MoveCollections.Delete. +type MoveCollectionsDeleteResult struct { + OperationStatus +} + +// MoveCollectionsDiscardPollerResponse contains the response from method MoveCollections.Discard. +type MoveCollectionsDiscardPollerResponse struct { + // Poller contains an initialized poller. + Poller *MoveCollectionsDiscardPoller + + // 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. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MoveCollectionsDiscardPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MoveCollectionsDiscardResponse, error) { + respType := MoveCollectionsDiscardResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MoveCollectionsDiscardPollerResponse from the provided client and resume token. +func (l *MoveCollectionsDiscardPollerResponse) Resume(ctx context.Context, client *MoveCollectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MoveCollectionsClient.Discard", token, client.pl, client.discardHandleError) + if err != nil { + return err + } + poller := &MoveCollectionsDiscardPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MoveCollectionsDiscardResponse contains the response from method MoveCollections.Discard. +type MoveCollectionsDiscardResponse struct { + MoveCollectionsDiscardResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsDiscardResult contains the result from method MoveCollections.Discard. +type MoveCollectionsDiscardResult struct { + OperationStatus +} + +// MoveCollectionsGetResponse contains the response from method MoveCollections.Get. +type MoveCollectionsGetResponse struct { + MoveCollectionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsGetResult contains the result from method MoveCollections.Get. +type MoveCollectionsGetResult struct { + MoveCollection +} + +// MoveCollectionsInitiateMovePollerResponse contains the response from method MoveCollections.InitiateMove. +type MoveCollectionsInitiateMovePollerResponse struct { + // Poller contains an initialized poller. + Poller *MoveCollectionsInitiateMovePoller + + // 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. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MoveCollectionsInitiateMovePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MoveCollectionsInitiateMoveResponse, error) { + respType := MoveCollectionsInitiateMoveResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MoveCollectionsInitiateMovePollerResponse from the provided client and resume token. +func (l *MoveCollectionsInitiateMovePollerResponse) Resume(ctx context.Context, client *MoveCollectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MoveCollectionsClient.InitiateMove", token, client.pl, client.initiateMoveHandleError) + if err != nil { + return err + } + poller := &MoveCollectionsInitiateMovePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MoveCollectionsInitiateMoveResponse contains the response from method MoveCollections.InitiateMove. +type MoveCollectionsInitiateMoveResponse struct { + MoveCollectionsInitiateMoveResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsInitiateMoveResult contains the result from method MoveCollections.InitiateMove. +type MoveCollectionsInitiateMoveResult struct { + OperationStatus +} + +// MoveCollectionsListMoveCollectionsByResourceGroupResponse contains the response from method MoveCollections.ListMoveCollectionsByResourceGroup. +type MoveCollectionsListMoveCollectionsByResourceGroupResponse struct { + MoveCollectionsListMoveCollectionsByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsListMoveCollectionsByResourceGroupResult contains the result from method MoveCollections.ListMoveCollectionsByResourceGroup. +type MoveCollectionsListMoveCollectionsByResourceGroupResult struct { + MoveCollectionResultList +} + +// MoveCollectionsListMoveCollectionsBySubscriptionResponse contains the response from method MoveCollections.ListMoveCollectionsBySubscription. +type MoveCollectionsListMoveCollectionsBySubscriptionResponse struct { + MoveCollectionsListMoveCollectionsBySubscriptionResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsListMoveCollectionsBySubscriptionResult contains the result from method MoveCollections.ListMoveCollectionsBySubscription. +type MoveCollectionsListMoveCollectionsBySubscriptionResult struct { + MoveCollectionResultList +} + +// MoveCollectionsListRequiredForResponse contains the response from method MoveCollections.ListRequiredFor. +type MoveCollectionsListRequiredForResponse struct { + MoveCollectionsListRequiredForResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsListRequiredForResult contains the result from method MoveCollections.ListRequiredFor. +type MoveCollectionsListRequiredForResult struct { + RequiredForResourcesCollection +} + +// MoveCollectionsPreparePollerResponse contains the response from method MoveCollections.Prepare. +type MoveCollectionsPreparePollerResponse struct { + // Poller contains an initialized poller. + Poller *MoveCollectionsPreparePoller + + // 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. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MoveCollectionsPreparePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MoveCollectionsPrepareResponse, error) { + respType := MoveCollectionsPrepareResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MoveCollectionsPreparePollerResponse from the provided client and resume token. +func (l *MoveCollectionsPreparePollerResponse) Resume(ctx context.Context, client *MoveCollectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MoveCollectionsClient.Prepare", token, client.pl, client.prepareHandleError) + if err != nil { + return err + } + poller := &MoveCollectionsPreparePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MoveCollectionsPrepareResponse contains the response from method MoveCollections.Prepare. +type MoveCollectionsPrepareResponse struct { + MoveCollectionsPrepareResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsPrepareResult contains the result from method MoveCollections.Prepare. +type MoveCollectionsPrepareResult struct { + OperationStatus +} + +// MoveCollectionsResolveDependenciesPollerResponse contains the response from method MoveCollections.ResolveDependencies. +type MoveCollectionsResolveDependenciesPollerResponse struct { + // Poller contains an initialized poller. + Poller *MoveCollectionsResolveDependenciesPoller + + // 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. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MoveCollectionsResolveDependenciesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MoveCollectionsResolveDependenciesResponse, error) { + respType := MoveCollectionsResolveDependenciesResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MoveCollectionsResolveDependenciesPollerResponse from the provided client and resume token. +func (l *MoveCollectionsResolveDependenciesPollerResponse) Resume(ctx context.Context, client *MoveCollectionsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MoveCollectionsClient.ResolveDependencies", token, client.pl, client.resolveDependenciesHandleError) + if err != nil { + return err + } + poller := &MoveCollectionsResolveDependenciesPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MoveCollectionsResolveDependenciesResponse contains the response from method MoveCollections.ResolveDependencies. +type MoveCollectionsResolveDependenciesResponse struct { + MoveCollectionsResolveDependenciesResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsResolveDependenciesResult contains the result from method MoveCollections.ResolveDependencies. +type MoveCollectionsResolveDependenciesResult struct { + OperationStatus +} + +// MoveCollectionsUpdateResponse contains the response from method MoveCollections.Update. +type MoveCollectionsUpdateResponse struct { + MoveCollectionsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveCollectionsUpdateResult contains the result from method MoveCollections.Update. +type MoveCollectionsUpdateResult struct { + MoveCollection +} + +// MoveResourcesCreatePollerResponse contains the response from method MoveResources.Create. +type MoveResourcesCreatePollerResponse struct { + // Poller contains an initialized poller. + Poller *MoveResourcesCreatePoller + + // 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. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MoveResourcesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MoveResourcesCreateResponse, error) { + respType := MoveResourcesCreateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MoveResource) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MoveResourcesCreatePollerResponse from the provided client and resume token. +func (l *MoveResourcesCreatePollerResponse) Resume(ctx context.Context, client *MoveResourcesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MoveResourcesClient.Create", token, client.pl, client.createHandleError) + if err != nil { + return err + } + poller := &MoveResourcesCreatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MoveResourcesCreateResponse contains the response from method MoveResources.Create. +type MoveResourcesCreateResponse struct { + MoveResourcesCreateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveResourcesCreateResult contains the result from method MoveResources.Create. +type MoveResourcesCreateResult struct { + MoveResource +} + +// MoveResourcesDeletePollerResponse contains the response from method MoveResources.Delete. +type MoveResourcesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *MoveResourcesDeletePoller + + // 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. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MoveResourcesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MoveResourcesDeleteResponse, error) { + respType := MoveResourcesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationStatus) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MoveResourcesDeletePollerResponse from the provided client and resume token. +func (l *MoveResourcesDeletePollerResponse) Resume(ctx context.Context, client *MoveResourcesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MoveResourcesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &MoveResourcesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MoveResourcesDeleteResponse contains the response from method MoveResources.Delete. +type MoveResourcesDeleteResponse struct { + MoveResourcesDeleteResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveResourcesDeleteResult contains the result from method MoveResources.Delete. +type MoveResourcesDeleteResult struct { + OperationStatus +} + +// MoveResourcesGetResponse contains the response from method MoveResources.Get. +type MoveResourcesGetResponse struct { + MoveResourcesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveResourcesGetResult contains the result from method MoveResources.Get. +type MoveResourcesGetResult struct { + MoveResource +} + +// MoveResourcesListResponse contains the response from method MoveResources.List. +type MoveResourcesListResponse struct { + MoveResourcesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MoveResourcesListResult contains the result from method MoveResources.List. +type MoveResourcesListResult struct { + MoveResourceCollection +} + +// OperationsDiscoveryGetResponse contains the response from method OperationsDiscovery.Get. +type OperationsDiscoveryGetResponse struct { + OperationsDiscoveryGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// OperationsDiscoveryGetResult contains the result from method OperationsDiscovery.Get. +type OperationsDiscoveryGetResult struct { + OperationsDiscoveryCollection +} + +// UnresolvedDependenciesGetResponse contains the response from method UnresolvedDependencies.Get. +type UnresolvedDependenciesGetResponse struct { + UnresolvedDependenciesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// UnresolvedDependenciesGetResult contains the result from method UnresolvedDependencies.Get. +type UnresolvedDependenciesGetResult struct { + UnresolvedDependencyCollection +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_time_rfc3339.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..0adebc9bab99 --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_time_rfc3339.go @@ -0,0 +1,85 @@ +//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 armresourcemover + +import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + +const ( + utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` + utcLayout = "2006-01-02T15:04:05.999999999" + rfc3339JSON = `"` + time.RFC3339Nano + `"` +) + +// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. +var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) + +type timeRFC3339 time.Time + +func (t timeRFC3339) MarshalJSON() (json []byte, err error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t timeRFC3339) MarshalText() (text []byte, err error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *timeRFC3339) UnmarshalJSON(data []byte) error { + layout := utcLayoutJSON + if tzOffsetRegex.Match(data) { + layout = rfc3339JSON + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { + layout := utcLayout + if tzOffsetRegex.Match(data) { + layout = time.RFC3339Nano + } + return t.Parse(layout, string(data)) +} + +func (t *timeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = timeRFC3339(p) + return err +} + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_unresolveddependencies_client.go b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_unresolveddependencies_client.go new file mode 100644 index 000000000000..d1650ac4381e --- /dev/null +++ b/sdk/resourcemanager/resourcemover/armresourcemover/zz_generated_unresolveddependencies_client.go @@ -0,0 +1,114 @@ +//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 armresourcemover + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "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" + "net/http" + "net/url" + "strings" +) + +// UnresolvedDependenciesClient contains the methods for the UnresolvedDependencies group. +// Don't use this type directly, use NewUnresolvedDependenciesClient() instead. +type UnresolvedDependenciesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewUnresolvedDependenciesClient creates a new instance of UnresolvedDependenciesClient with the specified values. +func NewUnresolvedDependenciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UnresolvedDependenciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UnresolvedDependenciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Gets a list of unresolved dependencies. +// If the operation fails it returns the *CloudError error type. +func (client *UnresolvedDependenciesClient) Get(resourceGroupName string, moveCollectionName string, options *UnresolvedDependenciesGetOptions) *UnresolvedDependenciesGetPager { + return &UnresolvedDependenciesGetPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.getCreateRequest(ctx, resourceGroupName, moveCollectionName, options) + }, + advancer: func(ctx context.Context, resp UnresolvedDependenciesGetResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.UnresolvedDependencyCollection.NextLink) + }, + } +} + +// getCreateRequest creates the Get request. +func (client *UnresolvedDependenciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, moveCollectionName string, options *UnresolvedDependenciesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/unresolvedDependencies" + 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 moveCollectionName == "" { + return nil, errors.New("parameter moveCollectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{moveCollectionName}", url.PathEscape(moveCollectionName)) + 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.DependencyLevel != nil { + reqQP.Set("dependencyLevel", string(*options.DependencyLevel)) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + reqQP.Set("api-version", "2021-08-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *UnresolvedDependenciesClient) getHandleResponse(resp *http.Response) (UnresolvedDependenciesGetResponse, error) { + result := UnresolvedDependenciesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.UnresolvedDependencyCollection); err != nil { + return UnresolvedDependenciesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *UnresolvedDependenciesClient) 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) +} From 2f74da6363d7283093df44e2f8e4a27de1072b59 Mon Sep 17 00:00:00 2001 From: Dapeng Zhang Date: Thu, 23 Dec 2021 14:24:13 +0800 Subject: [PATCH 2/2] Update CHANGELOG.md --- .../resourcemover/armresourcemover/CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/resourcemanager/resourcemover/armresourcemover/CHANGELOG.md b/sdk/resourcemanager/resourcemover/armresourcemover/CHANGELOG.md index fe78cfc7719e..1dea10904247 100644 --- a/sdk/resourcemanager/resourcemover/armresourcemover/CHANGELOG.md +++ b/sdk/resourcemanager/resourcemover/armresourcemover/CHANGELOG.md @@ -1,5 +1,5 @@ # Release History -## 0.1.0 (2021-12-17) +## 0.1.0 (2021-12-23) -- Init release. \ No newline at end of file +- Init release.