diff --git a/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md b/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md new file mode 100644 index 000000000000..490011fca132 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release History + +## 1.0.0 (2022-06-10) + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 1.0.0, which contains breaking changes. + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/azsdk/go/mgmt/migration). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/migrate/armmigrate/LICENSE.txt b/sdk/resourcemanager/migrate/armmigrate/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/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/migrate/armmigrate/README.md b/sdk/resourcemanager/migrate/armmigrate/README.md new file mode 100644 index 000000000000..e9bd4f9b0f96 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/README.md @@ -0,0 +1,77 @@ +# Azure Migrate Module for Go + +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate) + +The `armmigrate` module provides operations for working with Azure Migrate. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/migrate/armmigrate) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 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 Migrate module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Migrate. 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 Migrate 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, err := armmigrate.NewServerCollectorsClient(, 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{ + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +client, err := armmigrate.NewServerCollectorsClient(, 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 `Migrate` 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/migrate/armmigrate/autorest.md b/sdk/resourcemanager/migrate/armmigrate/autorest.md new file mode 100644 index 000000000000..e4d09bdf6b21 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/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/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/163e27c0ca7570bc39e00a46f255740d9b3ba3cb/specification/migrate/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 1.0.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/migrate/armmigrate/build.go b/sdk/resourcemanager/migrate/armmigrate/build.go new file mode 100644 index 000000000000..d5532b1ab92f --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/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/migrate/armmigrate + +package armmigrate diff --git a/sdk/resourcemanager/migrate/armmigrate/ci.yml b/sdk/resourcemanager/migrate/armmigrate/ci.yml new file mode 100644 index 000000000000..fad2a3779f21 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ci.yml @@ -0,0 +1,28 @@ +# 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/migrate/armmigrate/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/migrate/armmigrate/ + +stages: +- template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/migrate/armmigrate' diff --git a/sdk/resourcemanager/migrate/armmigrate/go.mod b/sdk/resourcemanager/migrate/armmigrate/go.mod new file mode 100644 index 000000000000..819cb999087f --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 +) + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect + github.com/golang-jwt/jwt v3.2.1+incompatible // indirect + github.com/google/uuid v1.1.1 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect + github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect + golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect + golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect + golang.org/x/text v0.3.7 // indirect +) diff --git a/sdk/resourcemanager/migrate/armmigrate/go.sum b/sdk/resourcemanager/migrate/armmigrate/go.sum new file mode 100644 index 000000000000..8828b17b1853 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/go.sum @@ -0,0 +1,33 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8= +github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE= +github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= +github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= +github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= +github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= +github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= +golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_assessedmachines_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_assessedmachines_client_test.go new file mode 100644 index 000000000000..7c946e013395 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_assessedmachines_client_test.go @@ -0,0 +1,70 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessedMachines_ListByAssessment.json +func ExampleAssessedMachinesClient_NewListByAssessmentPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewAssessedMachinesClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByAssessmentPager("abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "Test1", + "assessment_5_9_2019_16_22_14", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessedMachines_Get.json +func ExampleAssessedMachinesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewAssessedMachinesClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "Test1", + "assessment_5_9_2019_16_22_14", + "f57fe432-3bd2-486a-a83a-6f4d99f1a952", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_assessments_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_assessments_client_test.go new file mode 100644 index 000000000000..b5f1cd126e8b --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_assessments_client_test.go @@ -0,0 +1,178 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_ListByGroup.json +func ExampleAssessmentsClient_NewListByGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewAssessmentsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByGroupPager("abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "Test1", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_ListByProject.json +func ExampleAssessmentsClient_NewListByProjectPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewAssessmentsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByProjectPager("abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_Get.json +func ExampleAssessmentsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewAssessmentsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "Test1", + "assessment_5_9_2019_16_22_14", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_Create.json +func ExampleAssessmentsClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewAssessmentsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Create(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "Group2", + "assessment_5_14_2019_16_48_47", + &armmigrate.AssessmentsClientCreateOptions{Assessment: &armmigrate.Assessment{ + ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), + Properties: &armmigrate.AssessmentProperties{ + AzureDiskType: to.Ptr(armmigrate.AzureDiskTypeStandardOrPremium), + AzureHybridUseBenefit: to.Ptr(armmigrate.AzureHybridUseBenefitYes), + AzureLocation: to.Ptr(armmigrate.AzureLocationNorthEurope), + AzureOfferCode: to.Ptr(armmigrate.AzureOfferCodeMSAZR0003P), + AzurePricingTier: to.Ptr(armmigrate.AzurePricingTierStandard), + AzureStorageRedundancy: to.Ptr(armmigrate.AzureStorageRedundancyLocallyRedundant), + AzureVMFamilies: []*armmigrate.AzureVMFamily{ + to.Ptr(armmigrate.AzureVMFamilyDv2Series), + to.Ptr(armmigrate.AzureVMFamilyFSeries), + to.Ptr(armmigrate.AzureVMFamilyDv3Series), + to.Ptr(armmigrate.AzureVMFamilyDSSeries), + to.Ptr(armmigrate.AzureVMFamilyDSv2Series), + to.Ptr(armmigrate.AzureVMFamilyFsSeries), + to.Ptr(armmigrate.AzureVMFamilyDsv3Series), + to.Ptr(armmigrate.AzureVMFamilyEv3Series), + to.Ptr(armmigrate.AzureVMFamilyEsv3Series), + to.Ptr(armmigrate.AzureVMFamilyDSeries), + to.Ptr(armmigrate.AzureVMFamilyMSeries), + to.Ptr(armmigrate.AzureVMFamilyFsv2Series), + to.Ptr(armmigrate.AzureVMFamilyHSeries)}, + Currency: to.Ptr(armmigrate.CurrencyUSD), + DiscountPercentage: to.Ptr[float64](100), + Percentile: to.Ptr(armmigrate.PercentilePercentile95), + ReservedInstance: to.Ptr(armmigrate.ReservedInstanceRI3Year), + ScalingFactor: to.Ptr[float64](1), + SizingCriterion: to.Ptr(armmigrate.AssessmentSizingCriterionPerformanceBased), + Stage: to.Ptr(armmigrate.AssessmentStageInProgress), + TimeRange: to.Ptr(armmigrate.TimeRangeDay), + VMUptime: &armmigrate.VMUptime{ + DaysPerMonth: to.Ptr[int32](31), + HoursPerDay: to.Ptr[int32](24), + }, + }, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Assessments_Delete.json +func ExampleAssessmentsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewAssessmentsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "Test1", + "assessment_5_9_2019_16_22_14", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_groups_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_groups_client_test.go new file mode 100644 index 000000000000..d305c9f8030e --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_groups_client_test.go @@ -0,0 +1,138 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_ListByProject.json +func ExampleGroupsClient_NewListByProjectPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewGroupsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByProjectPager("abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_Get.json +func ExampleGroupsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewGroupsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "Test1", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_Create.json +func ExampleGroupsClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewGroupsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Create(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "Group2", + &armmigrate.GroupsClientCreateOptions{Group: &armmigrate.Group{ + ETag: to.Ptr("\"1e000c2c-0000-0d00-0000-5cdaa4190000\""), + Properties: &armmigrate.GroupProperties{}, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_Delete.json +func ExampleGroupsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewGroupsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "Test1", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Groups_UpdateMachines.json +func ExampleGroupsClient_UpdateMachines() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewGroupsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.UpdateMachines(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "Group2", + &armmigrate.GroupsClientUpdateMachinesOptions{GroupUpdateProperties: nil}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_hypervcollectors_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_hypervcollectors_client_test.go new file mode 100644 index 000000000000..530c5418ff03 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_hypervcollectors_client_test.go @@ -0,0 +1,126 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_ListByProject.json +func ExampleHyperVCollectorsClient_NewListByProjectPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewHyperVCollectorsClient("8c3c936a-c09b-4de3-830b-3f5f244d72e9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByProjectPager("contosoithyperv", + "migrateprojectce73project", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_Get.json +func ExampleHyperVCollectorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewHyperVCollectorsClient("8c3c936a-c09b-4de3-830b-3f5f244d72e9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "contosoithyperv", + "migrateprojectce73project", + "migrateprojectce73collector", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_Create.json +func ExampleHyperVCollectorsClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewHyperVCollectorsClient("8c3c936a-c09b-4de3-830b-3f5f244d72e9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Create(ctx, + "contosoithyperv", + "migrateprojectce73project", + "migrateprojectce73collector", + &armmigrate.HyperVCollectorsClientCreateOptions{CollectorBody: &armmigrate.HyperVCollector{ + ETag: to.Ptr("\"00000981-0000-0300-0000-5d74cd5f0000\""), + Properties: &armmigrate.CollectorProperties{ + AgentProperties: &armmigrate.CollectorAgentProperties{ + SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ + ApplicationID: to.Ptr("827f1053-44dc-439f-b832-05416dcce12b"), + Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/migrateprojectce73agentauthaadapp"), + Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), + ObjectID: to.Ptr("be75098e-c0fc-4ac4-98c7-282ebbcf8370"), + TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + }, + }, + DiscoverySiteID: to.Ptr("/subscriptions/8c3c936a-c09b-4de3-830b-3f5f244d72e9/resourceGroups/ContosoITHyperV/providers/Microsoft.OffAzure/HyperVSites/migrateprojectce73site"), + }, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/HyperVCollectors_Delete.json +func ExampleHyperVCollectorsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewHyperVCollectorsClient("8c3c936a-c09b-4de3-830b-3f5f244d72e9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, + "contosoithyperv", + "migrateprojectce73project", + "migrateprojectce73collector", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_importcollectors_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_importcollectors_client_test.go new file mode 100644 index 000000000000..04bc940a2f41 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_importcollectors_client_test.go @@ -0,0 +1,120 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_ListByProject.json +func ExampleImportCollectorsClient_NewListByProjectPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewImportCollectorsClient("31be0ff4-c932-4cb3-8efc-efa411d79280", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByProjectPager("markusavstestrg", + "rajoshCCY9671project", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_Get.json +func ExampleImportCollectorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewImportCollectorsClient("31be0ff4-c932-4cb3-8efc-efa411d79280", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "markusavstestrg", + "rajoshCCY9671project", + "importCollector2951", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_Create.json +func ExampleImportCollectorsClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewImportCollectorsClient("31be0ff4-c932-4cb3-8efc-efa411d79280", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Create(ctx, + "markusavstestrg", + "rajoshCCY9671project", + "importCollector2952", + &armmigrate.ImportCollectorsClientCreateOptions{CollectorBody: &armmigrate.ImportCollector{ + Name: to.Ptr("importCollector2951"), + Type: to.Ptr("Microsoft.Migrate/assessmentprojects/importcollectors"), + ETag: to.Ptr("\"000064a2-0000-3300-0000-605994800000\""), + ID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourceGroups/markusavstestrg/providers/Microsoft.Migrate/assessmentprojects/rajoshCCY9671project/importcollectors/importCollector2951"), + Properties: &armmigrate.ImportCollectorProperties{ + DiscoverySiteID: to.Ptr("/subscriptions/31be0ff4-c932-4cb3-8efc-efa411d79280/resourcegroups/MarkusAVStestRG/providers/microsoft.offazure/importsites/rajoshCCY54cbimportSite"), + }, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ImportCollectors_Delete.json +func ExampleImportCollectorsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewImportCollectorsClient("31be0ff4-c932-4cb3-8efc-efa411d79280", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, + "markusavstestrg", + "rajoshCCY9671project", + "importCollector2952", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_machines_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_machines_client_test.go new file mode 100644 index 000000000000..cc8144fbb99d --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_machines_client_test.go @@ -0,0 +1,66 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Machines_ListByProject.json +func ExampleMachinesClient_NewListByProjectPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewMachinesClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByProjectPager("abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Machines_Get.json +func ExampleMachinesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewMachinesClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "269ef295-a38d-4f8f-9779-77ce79088311", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_operations_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_operations_client_test.go new file mode 100644 index 000000000000..8ed5316887e2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_operations_client_test.go @@ -0,0 +1,41 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Operations_List.json +func ExampleOperationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewOperationsClient(cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_privateendpointconnection_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_privateendpointconnection_client_test.go new file mode 100644 index 000000000000..3b519df34ed9 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_privateendpointconnection_client_test.go @@ -0,0 +1,116 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_ListByProject.json +func ExamplePrivateEndpointConnectionClient_ListByProject() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewPrivateEndpointConnectionClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.ListByProject(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_Get.json +func ExamplePrivateEndpointConnectionClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewPrivateEndpointConnectionClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_Create.json +func ExamplePrivateEndpointConnectionClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewPrivateEndpointConnectionClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Update(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43", + &armmigrate.PrivateEndpointConnectionClientUpdateOptions{PrivateEndpointConnectionBody: &armmigrate.PrivateEndpointConnection{ + ETag: to.Ptr("\"00009300-0000-0300-0000-602b967b0000\""), + Properties: &armmigrate.PrivateEndpointConnectionProperties{ + PrivateLinkServiceConnectionState: &armmigrate.PrivateLinkServiceConnectionState{ + ActionsRequired: to.Ptr(""), + Status: to.Ptr(armmigrate.PrivateLinkServiceConnectionStateStatusApproved), + }, + }, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateEndpointConnections_Delete.json +func ExamplePrivateEndpointConnectionClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewPrivateEndpointConnectionClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "custestpece80project3980pe.7e35576b-3df4-478e-9759-f64351cf4f43", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_privatelinkresource_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_privatelinkresource_client_test.go new file mode 100644 index 000000000000..e3980ce8c5bb --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_privatelinkresource_client_test.go @@ -0,0 +1,62 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateLinkResources_Get.json +func ExamplePrivateLinkResourceClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewPrivateLinkResourceClient("4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "madhavicus", + "custestpece80project", + "Default", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/PrivateLinkResources_ListByProject.json +func ExamplePrivateLinkResourceClient_ListByProject() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewPrivateLinkResourceClient("4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.ListByProject(ctx, + "madhavicus", + "custestpece80project", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_projects_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_projects_client_test.go new file mode 100644 index 000000000000..90fb1ddc2eff --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_projects_client_test.go @@ -0,0 +1,220 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ProjectsInSubscription_List.json +func ExampleProjectsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewProjectsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListBySubscriptionPager(nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_List.json +func ExampleProjectsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewProjectsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListPager("abgoyal-westEurope", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Get.json +func ExampleProjectsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewProjectsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Create.json +func ExampleProjectsClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewProjectsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Create(ctx, + "abgoyal-westEurope", + "abGoyalProject2", + &armmigrate.ProjectsClientCreateOptions{Project: &armmigrate.Project{ + ETag: to.Ptr(""), + Location: to.Ptr("West Europe"), + Properties: &armmigrate.ProjectProperties{ + AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), + ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), + }, + Tags: map[string]interface{}{}, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Update.json +func ExampleProjectsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewProjectsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Update(ctx, + "abgoyal-westEurope", + "abGoyalProject2", + &armmigrate.ProjectsClientUpdateOptions{Project: &armmigrate.Project{ + ETag: to.Ptr(""), + Location: to.Ptr("West Europe"), + Properties: &armmigrate.ProjectProperties{ + AssessmentSolutionID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourcegroups/abgoyal-westeurope/providers/microsoft.migrate/migrateprojects/abgoyalweselfhost/Solutions/Servers-Assessment-ServerAssessment"), + ProjectStatus: to.Ptr(armmigrate.ProjectStatusActive), + }, + Tags: map[string]interface{}{}, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/Projects_Delete.json +func ExampleProjectsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewProjectsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, + "abgoyal-westEurope", + "abGoyalProject2", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessmentOptions_Get.json +func ExampleProjectsClient_AssessmentOptions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewProjectsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.AssessmentOptions(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "default", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/AssessmentOptions_List.json +func ExampleProjectsClient_NewAssessmentOptionsListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewProjectsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewAssessmentOptionsListPager("abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_servercollectors_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_servercollectors_client_test.go new file mode 100644 index 000000000000..fc9767c91fe3 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_servercollectors_client_test.go @@ -0,0 +1,126 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_ListByProject.json +func ExampleServerCollectorsClient_NewListByProjectPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewServerCollectorsClient("4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByProjectPager("pajindtest", + "app11141project", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_Get.json +func ExampleServerCollectorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewServerCollectorsClient("4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "pajindtest", + "app11141project", + "app23df4collector", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_Create.json +func ExampleServerCollectorsClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewServerCollectorsClient("4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Create(ctx, + "pajindtest", + "app11141project", + "app23df4collector", + &armmigrate.ServerCollectorsClientCreateOptions{CollectorBody: &armmigrate.ServerCollector{ + ETag: to.Ptr("\"00000606-0000-0d00-0000-605999bf0000\""), + Properties: &armmigrate.CollectorProperties{ + AgentProperties: &armmigrate.CollectorAgentProperties{ + SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ + ApplicationID: to.Ptr("ad9f701a-cc08-4421-b51f-b5762d58e9ba"), + Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/app23df4authandaccessaadapp"), + Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), + ObjectID: to.Ptr("b4975e42-9248-4a36-b99f-37eca377ea00"), + TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + }, + }, + DiscoverySiteID: to.Ptr("/subscriptions/4bd2aa0f-2bd2-4d67-91a8-5a4533d58600/resourceGroups/pajindTest/providers/Microsoft.OffAzure/ServerSites/app21141site"), + }, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/ServerCollectors_Delete.json +func ExampleServerCollectorsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewServerCollectorsClient("4bd2aa0f-2bd2-4d67-91a8-5a4533d58600", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, + "pajindtest", + "app11141project", + "app23df4collector", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_vmwarecollectors_client_test.go b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_vmwarecollectors_client_test.go new file mode 100644 index 000000000000..41e488f8d8a2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/ze_generated_example_vmwarecollectors_client_test.go @@ -0,0 +1,126 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate_test + +import ( + "context" + "log" + + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/migrate/armmigrate" +) + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_ListByProject.json +func ExampleVMwareCollectorsClient_NewListByProjectPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewVMwareCollectorsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := client.NewListByProjectPager("abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + nil) + for pager.More() { + nextResult, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range nextResult.Value { + // TODO: use page item + _ = v + } + } +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_Get.json +func ExampleVMwareCollectorsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewVMwareCollectorsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Get(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "PortalvCenterbc2fcollector", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_Create.json +func ExampleVMwareCollectorsClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewVMwareCollectorsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := client.Create(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "PortalvCenterbc2fcollector", + &armmigrate.VMwareCollectorsClientCreateOptions{CollectorBody: &armmigrate.VMwareCollector{ + ETag: to.Ptr("\"01003d32-0000-0d00-0000-5d74d2e50000\""), + Properties: &armmigrate.CollectorProperties{ + AgentProperties: &armmigrate.CollectorAgentProperties{ + SpnDetails: &armmigrate.CollectorBodyAgentSpnProperties{ + ApplicationID: to.Ptr("fc717575-8173-4b21-92a5-658b655e613e"), + Audience: to.Ptr("https://72f988bf-86f1-41af-91ab-2d7cd011db47/PortalvCenterbc2fagentauthaadapp"), + Authority: to.Ptr("https://login.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47"), + ObjectID: to.Ptr("29d94f38-db94-4980-aec0-0cfd55ab1cd0"), + TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"), + }, + }, + DiscoverySiteID: to.Ptr("/subscriptions/6393a73f-8d55-47ef-b6dd-179b3e0c7910/resourceGroups/abgoyal-westEurope/providers/Microsoft.OffAzure/VMwareSites/PortalvCenterbc2fsite"), + }, + }, + }) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // TODO: use response item + _ = res +} + +// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/migrate/resource-manager/Microsoft.Migrate/stable/2019-10-01/examples/VMwareCollectors_Delete.json +func ExampleVMwareCollectorsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + client, err := armmigrate.NewVMwareCollectorsClient("6393a73f-8d55-47ef-b6dd-179b3e0c7910", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + _, err = client.Delete(ctx, + "abgoyal-westEurope", + "abgoyalWEselfhostb72bproject", + "PortalvCenterbc2fcollector", + nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_assessedmachines_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_assessedmachines_client.go new file mode 100644 index 000000000000..10cb1b60fa39 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_assessedmachines_client.go @@ -0,0 +1,216 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// AssessedMachinesClient contains the methods for the AssessedMachines group. +// Don't use this type directly, use NewAssessedMachinesClient() instead. +type AssessedMachinesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAssessedMachinesClient creates a new instance of AssessedMachinesClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAssessedMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessedMachinesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AssessedMachinesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get an assessed machine with its size & cost estimate that was evaluated in the specified assessment. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// assessmentName - Unique name of an assessment within a project. +// assessedMachineName - Unique name of an assessed machine evaluated as part of an assessment. +// options - AssessedMachinesClientGetOptions contains the optional parameters for the AssessedMachinesClient.Get method. +func (client *AssessedMachinesClient) Get(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, assessedMachineName string, options *AssessedMachinesClientGetOptions) (AssessedMachinesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, assessedMachineName, options) + if err != nil { + return AssessedMachinesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssessedMachinesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssessedMachinesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AssessedMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, assessedMachineName string, options *AssessedMachinesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines/{assessedMachineName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + if assessedMachineName == "" { + return nil, errors.New("parameter assessedMachineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessedMachineName}", url.PathEscape(assessedMachineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AssessedMachinesClient) getHandleResponse(resp *http.Response) (AssessedMachinesClientGetResponse, error) { + result := AssessedMachinesClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AssessedMachine); err != nil { + return AssessedMachinesClientGetResponse{}, err + } + return result, nil +} + +// NewListByAssessmentPager - Get list of machines that assessed as part of the specified assessment. Returns a json array +// of objects of type 'assessedMachine' as specified in the Models section. +// Whenever an assessment is created or updated, it goes under computation. During this phase, the 'status' field of Assessment +// object reports 'Computing'. During the period when the assessment is under +// computation, the list of assessed machines is empty and no assessed machines are returned by this call. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// assessmentName - Unique name of an assessment within a project. +// options - AssessedMachinesClientListByAssessmentOptions contains the optional parameters for the AssessedMachinesClient.ListByAssessment +// method. +func (client *AssessedMachinesClient) NewListByAssessmentPager(resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessedMachinesClientListByAssessmentOptions) *runtime.Pager[AssessedMachinesClientListByAssessmentResponse] { + return runtime.NewPager(runtime.PagingHandler[AssessedMachinesClientListByAssessmentResponse]{ + More: func(page AssessedMachinesClientListByAssessmentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AssessedMachinesClientListByAssessmentResponse) (AssessedMachinesClientListByAssessmentResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByAssessmentCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return AssessedMachinesClientListByAssessmentResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssessedMachinesClientListByAssessmentResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssessedMachinesClientListByAssessmentResponse{}, runtime.NewResponseError(resp) + } + return client.listByAssessmentHandleResponse(resp) + }, + }) +} + +// listByAssessmentCreateRequest creates the ListByAssessment request. +func (client *AssessedMachinesClient) listByAssessmentCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessedMachinesClientListByAssessmentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByAssessmentHandleResponse handles the ListByAssessment response. +func (client *AssessedMachinesClient) listByAssessmentHandleResponse(resp *http.Response) (AssessedMachinesClientListByAssessmentResponse, error) { + result := AssessedMachinesClientListByAssessmentResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AssessedMachineResultList); err != nil { + return AssessedMachinesClientListByAssessmentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_assessments_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_assessments_client.go new file mode 100644 index 000000000000..449dc423503d --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_assessments_client.go @@ -0,0 +1,484 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// AssessmentsClient contains the methods for the Assessments group. +// Don't use this type directly, use NewAssessmentsClient() instead. +type AssessmentsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewAssessmentsClient creates a new instance of AssessmentsClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessmentsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &AssessmentsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Create - Create a new assessment with the given name and the specified settings. Since name of an assessment in a project +// is a unique identifier, if an assessment with the name provided already exists, then +// the existing assessment is updated. +// Any PUT operation, resulting in either create or update on an assessment, will cause the assessment to go in a "InProgress" +// state. This will be indicated by the field 'computationState' on the +// Assessment object. During this time no other PUT operation will be allowed on that assessment object, nor will a Delete +// operation. Once the computation for the assessment is complete, the field +// 'computationState' will be updated to 'Ready', and then other PUT or DELETE operations can happen on the assessment. +// When assessment is under computation, any PUT will lead to a 400 - Bad Request error. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// assessmentName - Unique name of an assessment within a project. +// options - AssessmentsClientCreateOptions contains the optional parameters for the AssessmentsClient.Create method. +func (client *AssessmentsClient) Create(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientCreateOptions) (AssessmentsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) + if err != nil { + return AssessmentsClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssessmentsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return AssessmentsClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *AssessmentsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Assessment != nil { + return req, runtime.MarshalAsJSON(req, *options.Assessment) + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *AssessmentsClient) createHandleResponse(resp *http.Response) (AssessmentsClientCreateResponse, error) { + result := AssessmentsClientCreateResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Assessment); err != nil { + return AssessmentsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete an assessment from the project. The machines remain in the assessment. Deleting a non-existent assessment +// results in a no-operation. +// When an assessment is under computation, as indicated by the 'computationState' field, it cannot be deleted. Any such attempt +// will return a 400 - Bad Request. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// assessmentName - Unique name of an assessment within a project. +// options - AssessmentsClientDeleteOptions contains the optional parameters for the AssessmentsClient.Delete method. +func (client *AssessmentsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientDeleteOptions) (AssessmentsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) + if err != nil { + return AssessmentsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssessmentsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return AssessmentsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return client.deleteHandleResponse(resp) +} + +// deleteCreateRequest creates the Delete request. +func (client *AssessmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *AssessmentsClient) deleteHandleResponse(resp *http.Response) (AssessmentsClientDeleteResponse, error) { + result := AssessmentsClientDeleteResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + return result, nil +} + +// Get - Get an existing assessment with the specified name. Returns a json object of type 'assessment' as specified in Models +// section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// assessmentName - Unique name of an assessment within a project. +// options - AssessmentsClientGetOptions contains the optional parameters for the AssessmentsClient.Get method. +func (client *AssessmentsClient) Get(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetOptions) (AssessmentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) + if err != nil { + return AssessmentsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssessmentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssessmentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *AssessmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AssessmentsClient) getHandleResponse(resp *http.Response) (AssessmentsClientGetResponse, error) { + result := AssessmentsClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Assessment); err != nil { + return AssessmentsClientGetResponse{}, err + } + return result, nil +} + +// GetReportDownloadURL - Get the URL for downloading the assessment in a report format. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// assessmentName - Unique name of an assessment within a project. +// options - AssessmentsClientGetReportDownloadURLOptions contains the optional parameters for the AssessmentsClient.GetReportDownloadURL +// method. +func (client *AssessmentsClient) GetReportDownloadURL(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetReportDownloadURLOptions) (AssessmentsClientGetReportDownloadURLResponse, error) { + req, err := client.getReportDownloadURLCreateRequest(ctx, resourceGroupName, projectName, groupName, assessmentName, options) + if err != nil { + return AssessmentsClientGetReportDownloadURLResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssessmentsClientGetReportDownloadURLResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssessmentsClientGetReportDownloadURLResponse{}, runtime.NewResponseError(resp) + } + return client.getReportDownloadURLHandleResponse(resp) +} + +// getReportDownloadURLCreateRequest creates the GetReportDownloadURL request. +func (client *AssessmentsClient) getReportDownloadURLCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, assessmentName string, options *AssessmentsClientGetReportDownloadURLOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/downloadUrl" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getReportDownloadURLHandleResponse handles the GetReportDownloadURL response. +func (client *AssessmentsClient) getReportDownloadURLHandleResponse(resp *http.Response) (AssessmentsClientGetReportDownloadURLResponse, error) { + result := AssessmentsClientGetReportDownloadURLResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.DownloadURL); err != nil { + return AssessmentsClientGetReportDownloadURLResponse{}, err + } + return result, nil +} + +// NewListByGroupPager - Get all assessments created for the specified group. +// Returns a json array of objects of type 'assessment' as specified in Models section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// options - AssessmentsClientListByGroupOptions contains the optional parameters for the AssessmentsClient.ListByGroup method. +func (client *AssessmentsClient) NewListByGroupPager(resourceGroupName string, projectName string, groupName string, options *AssessmentsClientListByGroupOptions) *runtime.Pager[AssessmentsClientListByGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AssessmentsClientListByGroupResponse]{ + More: func(page AssessmentsClientListByGroupResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *AssessmentsClientListByGroupResponse) (AssessmentsClientListByGroupResponse, error) { + req, err := client.listByGroupCreateRequest(ctx, resourceGroupName, projectName, groupName, options) + if err != nil { + return AssessmentsClientListByGroupResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssessmentsClientListByGroupResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssessmentsClientListByGroupResponse{}, runtime.NewResponseError(resp) + } + return client.listByGroupHandleResponse(resp) + }, + }) +} + +// listByGroupCreateRequest creates the ListByGroup request. +func (client *AssessmentsClient) listByGroupCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *AssessmentsClientListByGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByGroupHandleResponse handles the ListByGroup response. +func (client *AssessmentsClient) listByGroupHandleResponse(resp *http.Response) (AssessmentsClientListByGroupResponse, error) { + result := AssessmentsClientListByGroupResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentResultList); err != nil { + return AssessmentsClientListByGroupResponse{}, err + } + return result, nil +} + +// NewListByProjectPager - Get all assessments created in the project. +// Returns a json array of objects of type 'assessment' as specified in Models section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - AssessmentsClientListByProjectOptions contains the optional parameters for the AssessmentsClient.ListByProject +// method. +func (client *AssessmentsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *AssessmentsClientListByProjectOptions) *runtime.Pager[AssessmentsClientListByProjectResponse] { + return runtime.NewPager(runtime.PagingHandler[AssessmentsClientListByProjectResponse]{ + More: func(page AssessmentsClientListByProjectResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *AssessmentsClientListByProjectResponse) (AssessmentsClientListByProjectResponse, error) { + req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return AssessmentsClientListByProjectResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AssessmentsClientListByProjectResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return AssessmentsClientListByProjectResponse{}, runtime.NewResponseError(resp) + } + return client.listByProjectHandleResponse(resp) + }, + }) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *AssessmentsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *AssessmentsClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessments" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *AssessmentsClient) listByProjectHandleResponse(resp *http.Response) (AssessmentsClientListByProjectResponse, error) { + result := AssessmentsClientListByProjectResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentResultList); err != nil { + return AssessmentsClientListByProjectResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_constants.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_constants.go new file mode 100644 index 000000000000..54fc29e53eeb --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_constants.go @@ -0,0 +1,1230 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +const ( + moduleName = "armmigrate" + moduleVersion = "v1.0.0" +) + +// AssessmentSizingCriterion - Assessment sizing criterion. +type AssessmentSizingCriterion string + +const ( + AssessmentSizingCriterionAsOnPremises AssessmentSizingCriterion = "AsOnPremises" + AssessmentSizingCriterionPerformanceBased AssessmentSizingCriterion = "PerformanceBased" +) + +// PossibleAssessmentSizingCriterionValues returns the possible values for the AssessmentSizingCriterion const type. +func PossibleAssessmentSizingCriterionValues() []AssessmentSizingCriterion { + return []AssessmentSizingCriterion{ + AssessmentSizingCriterionAsOnPremises, + AssessmentSizingCriterionPerformanceBased, + } +} + +// AssessmentStage - User configurable setting that describes the status of the assessment. +type AssessmentStage string + +const ( + AssessmentStageApproved AssessmentStage = "Approved" + AssessmentStageInProgress AssessmentStage = "InProgress" + AssessmentStageUnderReview AssessmentStage = "UnderReview" +) + +// PossibleAssessmentStageValues returns the possible values for the AssessmentStage const type. +func PossibleAssessmentStageValues() []AssessmentStage { + return []AssessmentStage{ + AssessmentStageApproved, + AssessmentStageInProgress, + AssessmentStageUnderReview, + } +} + +// AssessmentStatus - Whether the assessment has been created and is valid. +type AssessmentStatus string + +const ( + AssessmentStatusCompleted AssessmentStatus = "Completed" + AssessmentStatusCreated AssessmentStatus = "Created" + AssessmentStatusInvalid AssessmentStatus = "Invalid" + AssessmentStatusOutDated AssessmentStatus = "OutDated" + AssessmentStatusOutOfSync AssessmentStatus = "OutOfSync" + AssessmentStatusRunning AssessmentStatus = "Running" + AssessmentStatusUpdated AssessmentStatus = "Updated" +) + +// PossibleAssessmentStatusValues returns the possible values for the AssessmentStatus const type. +func PossibleAssessmentStatusValues() []AssessmentStatus { + return []AssessmentStatus{ + AssessmentStatusCompleted, + AssessmentStatusCreated, + AssessmentStatusInvalid, + AssessmentStatusOutDated, + AssessmentStatusOutOfSync, + AssessmentStatusRunning, + AssessmentStatusUpdated, + } +} + +// AzureDiskSize - Recommended Azure size for the disk, given utilization data and preferences set on Assessment. +type AzureDiskSize string + +const ( + AzureDiskSizePremiumP10 AzureDiskSize = "Premium_P10" + AzureDiskSizePremiumP15 AzureDiskSize = "Premium_P15" + AzureDiskSizePremiumP20 AzureDiskSize = "Premium_P20" + AzureDiskSizePremiumP30 AzureDiskSize = "Premium_P30" + AzureDiskSizePremiumP4 AzureDiskSize = "Premium_P4" + AzureDiskSizePremiumP40 AzureDiskSize = "Premium_P40" + AzureDiskSizePremiumP50 AzureDiskSize = "Premium_P50" + AzureDiskSizePremiumP6 AzureDiskSize = "Premium_P6" + AzureDiskSizePremiumP60 AzureDiskSize = "Premium_P60" + AzureDiskSizePremiumP70 AzureDiskSize = "Premium_P70" + AzureDiskSizePremiumP80 AzureDiskSize = "Premium_P80" + AzureDiskSizeStandardS10 AzureDiskSize = "Standard_S10" + AzureDiskSizeStandardS15 AzureDiskSize = "Standard_S15" + AzureDiskSizeStandardS20 AzureDiskSize = "Standard_S20" + AzureDiskSizeStandardS30 AzureDiskSize = "Standard_S30" + AzureDiskSizeStandardS4 AzureDiskSize = "Standard_S4" + AzureDiskSizeStandardS40 AzureDiskSize = "Standard_S40" + AzureDiskSizeStandardS50 AzureDiskSize = "Standard_S50" + AzureDiskSizeStandardS6 AzureDiskSize = "Standard_S6" + AzureDiskSizeStandardS60 AzureDiskSize = "Standard_S60" + AzureDiskSizeStandardS70 AzureDiskSize = "Standard_S70" + AzureDiskSizeStandardS80 AzureDiskSize = "Standard_S80" + AzureDiskSizeStandardSSDE10 AzureDiskSize = "StandardSSD_E10" + AzureDiskSizeStandardSSDE15 AzureDiskSize = "StandardSSD_E15" + AzureDiskSizeStandardSSDE20 AzureDiskSize = "StandardSSD_E20" + AzureDiskSizeStandardSSDE30 AzureDiskSize = "StandardSSD_E30" + AzureDiskSizeStandardSSDE4 AzureDiskSize = "StandardSSD_E4" + AzureDiskSizeStandardSSDE40 AzureDiskSize = "StandardSSD_E40" + AzureDiskSizeStandardSSDE50 AzureDiskSize = "StandardSSD_E50" + AzureDiskSizeStandardSSDE6 AzureDiskSize = "StandardSSD_E6" + AzureDiskSizeStandardSSDE60 AzureDiskSize = "StandardSSD_E60" + AzureDiskSizeStandardSSDE70 AzureDiskSize = "StandardSSD_E70" + AzureDiskSizeStandardSSDE80 AzureDiskSize = "StandardSSD_E80" + AzureDiskSizeUnknown AzureDiskSize = "Unknown" +) + +// PossibleAzureDiskSizeValues returns the possible values for the AzureDiskSize const type. +func PossibleAzureDiskSizeValues() []AzureDiskSize { + return []AzureDiskSize{ + AzureDiskSizePremiumP10, + AzureDiskSizePremiumP15, + AzureDiskSizePremiumP20, + AzureDiskSizePremiumP30, + AzureDiskSizePremiumP4, + AzureDiskSizePremiumP40, + AzureDiskSizePremiumP50, + AzureDiskSizePremiumP6, + AzureDiskSizePremiumP60, + AzureDiskSizePremiumP70, + AzureDiskSizePremiumP80, + AzureDiskSizeStandardS10, + AzureDiskSizeStandardS15, + AzureDiskSizeStandardS20, + AzureDiskSizeStandardS30, + AzureDiskSizeStandardS4, + AzureDiskSizeStandardS40, + AzureDiskSizeStandardS50, + AzureDiskSizeStandardS6, + AzureDiskSizeStandardS60, + AzureDiskSizeStandardS70, + AzureDiskSizeStandardS80, + AzureDiskSizeStandardSSDE10, + AzureDiskSizeStandardSSDE15, + AzureDiskSizeStandardSSDE20, + AzureDiskSizeStandardSSDE30, + AzureDiskSizeStandardSSDE4, + AzureDiskSizeStandardSSDE40, + AzureDiskSizeStandardSSDE50, + AzureDiskSizeStandardSSDE6, + AzureDiskSizeStandardSSDE60, + AzureDiskSizeStandardSSDE70, + AzureDiskSizeStandardSSDE80, + AzureDiskSizeUnknown, + } +} + +// AzureDiskSuitabilityDetail - If disk is suitable to be migrate but some conditions/checks were not considered while calculating +// suitability, this explains the details. +type AzureDiskSuitabilityDetail string + +const ( + AzureDiskSuitabilityDetailDiskGigabytesConsumedMissing AzureDiskSuitabilityDetail = "DiskGigabytesConsumedMissing" + AzureDiskSuitabilityDetailDiskGigabytesConsumedOutOfRange AzureDiskSuitabilityDetail = "DiskGigabytesConsumedOutOfRange" + AzureDiskSuitabilityDetailDiskGigabytesProvisionedMissing AzureDiskSuitabilityDetail = "DiskGigabytesProvisionedMissing" + AzureDiskSuitabilityDetailDiskGigabytesProvisionedOutOfRange AzureDiskSuitabilityDetail = "DiskGigabytesProvisionedOutOfRange" + AzureDiskSuitabilityDetailMegabytesPerSecondOfReadMissing AzureDiskSuitabilityDetail = "MegabytesPerSecondOfReadMissing" + AzureDiskSuitabilityDetailMegabytesPerSecondOfReadOutOfRange AzureDiskSuitabilityDetail = "MegabytesPerSecondOfReadOutOfRange" + AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteMissing AzureDiskSuitabilityDetail = "MegabytesPerSecondOfWriteMissing" + AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteOutOfRange AzureDiskSuitabilityDetail = "MegabytesPerSecondOfWriteOutOfRange" + AzureDiskSuitabilityDetailNone AzureDiskSuitabilityDetail = "None" + AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondMissing AzureDiskSuitabilityDetail = "NumberOfReadOperationsPerSecondMissing" + AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondOutOfRange AzureDiskSuitabilityDetail = "NumberOfReadOperationsPerSecondOutOfRange" + AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondMissing AzureDiskSuitabilityDetail = "NumberOfWriteOperationsPerSecondMissing" + AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondOutOfRange AzureDiskSuitabilityDetail = "NumberOfWriteOperationsPerSecondOutOfRange" +) + +// PossibleAzureDiskSuitabilityDetailValues returns the possible values for the AzureDiskSuitabilityDetail const type. +func PossibleAzureDiskSuitabilityDetailValues() []AzureDiskSuitabilityDetail { + return []AzureDiskSuitabilityDetail{ + AzureDiskSuitabilityDetailDiskGigabytesConsumedMissing, + AzureDiskSuitabilityDetailDiskGigabytesConsumedOutOfRange, + AzureDiskSuitabilityDetailDiskGigabytesProvisionedMissing, + AzureDiskSuitabilityDetailDiskGigabytesProvisionedOutOfRange, + AzureDiskSuitabilityDetailMegabytesPerSecondOfReadMissing, + AzureDiskSuitabilityDetailMegabytesPerSecondOfReadOutOfRange, + AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteMissing, + AzureDiskSuitabilityDetailMegabytesPerSecondOfWriteOutOfRange, + AzureDiskSuitabilityDetailNone, + AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondMissing, + AzureDiskSuitabilityDetailNumberOfReadOperationsPerSecondOutOfRange, + AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondMissing, + AzureDiskSuitabilityDetailNumberOfWriteOperationsPerSecondOutOfRange, + } +} + +// AzureDiskSuitabilityExplanation - If disk is not suitable to be migrated, this explains the reasons and mitigation steps. +type AzureDiskSuitabilityExplanation string + +const ( + AzureDiskSuitabilityExplanationDiskSizeGreaterThanSupported AzureDiskSuitabilityExplanation = "DiskSizeGreaterThanSupported" + AzureDiskSuitabilityExplanationInternalErrorOccurredForDiskEvaluation AzureDiskSuitabilityExplanation = "InternalErrorOccurredForDiskEvaluation" + AzureDiskSuitabilityExplanationNoDiskSizeFoundForSelectedRedundancy AzureDiskSuitabilityExplanation = "NoDiskSizeFoundForSelectedRedundancy" + AzureDiskSuitabilityExplanationNoDiskSizeFoundInSelectedLocation AzureDiskSuitabilityExplanation = "NoDiskSizeFoundInSelectedLocation" + AzureDiskSuitabilityExplanationNoEaPriceFoundForDiskSize AzureDiskSuitabilityExplanation = "NoEaPriceFoundForDiskSize" + AzureDiskSuitabilityExplanationNoSuitableDiskSizeForIops AzureDiskSuitabilityExplanation = "NoSuitableDiskSizeForIops" + AzureDiskSuitabilityExplanationNoSuitableDiskSizeForThroughput AzureDiskSuitabilityExplanation = "NoSuitableDiskSizeForThroughput" + AzureDiskSuitabilityExplanationNotApplicable AzureDiskSuitabilityExplanation = "NotApplicable" + AzureDiskSuitabilityExplanationUnknown AzureDiskSuitabilityExplanation = "Unknown" +) + +// PossibleAzureDiskSuitabilityExplanationValues returns the possible values for the AzureDiskSuitabilityExplanation const type. +func PossibleAzureDiskSuitabilityExplanationValues() []AzureDiskSuitabilityExplanation { + return []AzureDiskSuitabilityExplanation{ + AzureDiskSuitabilityExplanationDiskSizeGreaterThanSupported, + AzureDiskSuitabilityExplanationInternalErrorOccurredForDiskEvaluation, + AzureDiskSuitabilityExplanationNoDiskSizeFoundForSelectedRedundancy, + AzureDiskSuitabilityExplanationNoDiskSizeFoundInSelectedLocation, + AzureDiskSuitabilityExplanationNoEaPriceFoundForDiskSize, + AzureDiskSuitabilityExplanationNoSuitableDiskSizeForIops, + AzureDiskSuitabilityExplanationNoSuitableDiskSizeForThroughput, + AzureDiskSuitabilityExplanationNotApplicable, + AzureDiskSuitabilityExplanationUnknown, + } +} + +// AzureDiskType - Storage type selected for this disk. +type AzureDiskType string + +const ( + AzureDiskTypePremium AzureDiskType = "Premium" + AzureDiskTypeStandard AzureDiskType = "Standard" + AzureDiskTypeStandardOrPremium AzureDiskType = "StandardOrPremium" + AzureDiskTypeStandardSSD AzureDiskType = "StandardSSD" + AzureDiskTypeUnknown AzureDiskType = "Unknown" +) + +// PossibleAzureDiskTypeValues returns the possible values for the AzureDiskType const type. +func PossibleAzureDiskTypeValues() []AzureDiskType { + return []AzureDiskType{ + AzureDiskTypePremium, + AzureDiskTypeStandard, + AzureDiskTypeStandardOrPremium, + AzureDiskTypeStandardSSD, + AzureDiskTypeUnknown, + } +} + +// AzureHybridUseBenefit - AHUB discount on windows virtual machines. +type AzureHybridUseBenefit string + +const ( + AzureHybridUseBenefitNo AzureHybridUseBenefit = "No" + AzureHybridUseBenefitUnknown AzureHybridUseBenefit = "Unknown" + AzureHybridUseBenefitYes AzureHybridUseBenefit = "Yes" +) + +// PossibleAzureHybridUseBenefitValues returns the possible values for the AzureHybridUseBenefit const type. +func PossibleAzureHybridUseBenefitValues() []AzureHybridUseBenefit { + return []AzureHybridUseBenefit{ + AzureHybridUseBenefitNo, + AzureHybridUseBenefitUnknown, + AzureHybridUseBenefitYes, + } +} + +// AzureLocation - Target Azure location for which the machines should be assessed. These enums are the same as used by Compute +// API. +type AzureLocation string + +const ( + AzureLocationAustraliaEast AzureLocation = "AustraliaEast" + AzureLocationAustraliaSoutheast AzureLocation = "AustraliaSoutheast" + AzureLocationBrazilSouth AzureLocation = "BrazilSouth" + AzureLocationCanadaCentral AzureLocation = "CanadaCentral" + AzureLocationCanadaEast AzureLocation = "CanadaEast" + AzureLocationCentralIndia AzureLocation = "CentralIndia" + AzureLocationCentralUs AzureLocation = "CentralUs" + AzureLocationChinaEast AzureLocation = "ChinaEast" + AzureLocationChinaNorth AzureLocation = "ChinaNorth" + AzureLocationEastAsia AzureLocation = "EastAsia" + AzureLocationEastUs AzureLocation = "EastUs" + AzureLocationEastUs2 AzureLocation = "EastUs2" + AzureLocationGermanyCentral AzureLocation = "GermanyCentral" + AzureLocationGermanyNortheast AzureLocation = "GermanyNortheast" + AzureLocationJapanEast AzureLocation = "JapanEast" + AzureLocationJapanWest AzureLocation = "JapanWest" + AzureLocationKoreaCentral AzureLocation = "KoreaCentral" + AzureLocationKoreaSouth AzureLocation = "KoreaSouth" + AzureLocationNorthCentralUs AzureLocation = "NorthCentralUs" + AzureLocationNorthEurope AzureLocation = "NorthEurope" + AzureLocationSouthCentralUs AzureLocation = "SouthCentralUs" + AzureLocationSouthIndia AzureLocation = "SouthIndia" + AzureLocationSoutheastAsia AzureLocation = "SoutheastAsia" + AzureLocationUSDoDCentral AzureLocation = "USDoDCentral" + AzureLocationUSDoDEast AzureLocation = "USDoDEast" + AzureLocationUSGovArizona AzureLocation = "USGovArizona" + AzureLocationUSGovIowa AzureLocation = "USGovIowa" + AzureLocationUSGovTexas AzureLocation = "USGovTexas" + AzureLocationUSGovVirginia AzureLocation = "USGovVirginia" + AzureLocationUkSouth AzureLocation = "UkSouth" + AzureLocationUkWest AzureLocation = "UkWest" + AzureLocationUnknown AzureLocation = "Unknown" + AzureLocationWestCentralUs AzureLocation = "WestCentralUs" + AzureLocationWestEurope AzureLocation = "WestEurope" + AzureLocationWestIndia AzureLocation = "WestIndia" + AzureLocationWestUs AzureLocation = "WestUs" + AzureLocationWestUs2 AzureLocation = "WestUs2" +) + +// PossibleAzureLocationValues returns the possible values for the AzureLocation const type. +func PossibleAzureLocationValues() []AzureLocation { + return []AzureLocation{ + AzureLocationAustraliaEast, + AzureLocationAustraliaSoutheast, + AzureLocationBrazilSouth, + AzureLocationCanadaCentral, + AzureLocationCanadaEast, + AzureLocationCentralIndia, + AzureLocationCentralUs, + AzureLocationChinaEast, + AzureLocationChinaNorth, + AzureLocationEastAsia, + AzureLocationEastUs, + AzureLocationEastUs2, + AzureLocationGermanyCentral, + AzureLocationGermanyNortheast, + AzureLocationJapanEast, + AzureLocationJapanWest, + AzureLocationKoreaCentral, + AzureLocationKoreaSouth, + AzureLocationNorthCentralUs, + AzureLocationNorthEurope, + AzureLocationSouthCentralUs, + AzureLocationSouthIndia, + AzureLocationSoutheastAsia, + AzureLocationUSDoDCentral, + AzureLocationUSDoDEast, + AzureLocationUSGovArizona, + AzureLocationUSGovIowa, + AzureLocationUSGovTexas, + AzureLocationUSGovVirginia, + AzureLocationUkSouth, + AzureLocationUkWest, + AzureLocationUnknown, + AzureLocationWestCentralUs, + AzureLocationWestEurope, + AzureLocationWestIndia, + AzureLocationWestUs, + AzureLocationWestUs2, + } +} + +// AzureNetworkAdapterSuitabilityDetail - If network adapter is not suitable for cloud, this explains the reasons. +type AzureNetworkAdapterSuitabilityDetail string + +const ( + AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing AzureNetworkAdapterSuitabilityDetail = "MegabytesOfDataTransmittedMissing" + AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedOutOfRange AzureNetworkAdapterSuitabilityDetail = "MegabytesOfDataTransmittedOutOfRange" + AzureNetworkAdapterSuitabilityDetailNone AzureNetworkAdapterSuitabilityDetail = "None" +) + +// PossibleAzureNetworkAdapterSuitabilityDetailValues returns the possible values for the AzureNetworkAdapterSuitabilityDetail const type. +func PossibleAzureNetworkAdapterSuitabilityDetailValues() []AzureNetworkAdapterSuitabilityDetail { + return []AzureNetworkAdapterSuitabilityDetail{ + AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedMissing, + AzureNetworkAdapterSuitabilityDetailMegabytesOfDataTransmittedOutOfRange, + AzureNetworkAdapterSuitabilityDetailNone, + } +} + +// AzureNetworkAdapterSuitabilityExplanation - If network adapter is suitable, this explains the reasons and mitigation steps. +type AzureNetworkAdapterSuitabilityExplanation string + +const ( + AzureNetworkAdapterSuitabilityExplanationInternalErrorOccurred AzureNetworkAdapterSuitabilityExplanation = "InternalErrorOccurred" + AzureNetworkAdapterSuitabilityExplanationNotApplicable AzureNetworkAdapterSuitabilityExplanation = "NotApplicable" + AzureNetworkAdapterSuitabilityExplanationUnknown AzureNetworkAdapterSuitabilityExplanation = "Unknown" +) + +// PossibleAzureNetworkAdapterSuitabilityExplanationValues returns the possible values for the AzureNetworkAdapterSuitabilityExplanation const type. +func PossibleAzureNetworkAdapterSuitabilityExplanationValues() []AzureNetworkAdapterSuitabilityExplanation { + return []AzureNetworkAdapterSuitabilityExplanation{ + AzureNetworkAdapterSuitabilityExplanationInternalErrorOccurred, + AzureNetworkAdapterSuitabilityExplanationNotApplicable, + AzureNetworkAdapterSuitabilityExplanationUnknown, + } +} + +// AzureOfferCode - Offer code according to which cost estimation is done. +type AzureOfferCode string + +const ( + AzureOfferCodeEA AzureOfferCode = "EA" + AzureOfferCodeMSAZR0003P AzureOfferCode = "MSAZR0003P" + AzureOfferCodeMSAZR0022P AzureOfferCode = "MSAZR0022P" + AzureOfferCodeMSAZR0023P AzureOfferCode = "MSAZR0023P" + AzureOfferCodeMSAZR0025P AzureOfferCode = "MSAZR0025P" + AzureOfferCodeMSAZR0029P AzureOfferCode = "MSAZR0029P" + AzureOfferCodeMSAZR0036P AzureOfferCode = "MSAZR0036P" + AzureOfferCodeMSAZR0044P AzureOfferCode = "MSAZR0044P" + AzureOfferCodeMSAZR0059P AzureOfferCode = "MSAZR0059P" + AzureOfferCodeMSAZR0060P AzureOfferCode = "MSAZR0060P" + AzureOfferCodeMSAZR0062P AzureOfferCode = "MSAZR0062P" + AzureOfferCodeMSAZR0063P AzureOfferCode = "MSAZR0063P" + AzureOfferCodeMSAZR0064P AzureOfferCode = "MSAZR0064P" + AzureOfferCodeMSAZR0111P AzureOfferCode = "MSAZR0111P" + AzureOfferCodeMSAZR0120P AzureOfferCode = "MSAZR0120P" + AzureOfferCodeMSAZR0121P AzureOfferCode = "MSAZR0121P" + AzureOfferCodeMSAZR0122P AzureOfferCode = "MSAZR0122P" + AzureOfferCodeMSAZR0123P AzureOfferCode = "MSAZR0123P" + AzureOfferCodeMSAZR0124P AzureOfferCode = "MSAZR0124P" + AzureOfferCodeMSAZR0125P AzureOfferCode = "MSAZR0125P" + AzureOfferCodeMSAZR0126P AzureOfferCode = "MSAZR0126P" + AzureOfferCodeMSAZR0127P AzureOfferCode = "MSAZR0127P" + AzureOfferCodeMSAZR0128P AzureOfferCode = "MSAZR0128P" + AzureOfferCodeMSAZR0129P AzureOfferCode = "MSAZR0129P" + AzureOfferCodeMSAZR0130P AzureOfferCode = "MSAZR0130P" + AzureOfferCodeMSAZR0144P AzureOfferCode = "MSAZR0144P" + AzureOfferCodeMSAZR0148P AzureOfferCode = "MSAZR0148P" + AzureOfferCodeMSAZR0149P AzureOfferCode = "MSAZR0149P" + AzureOfferCodeMSAZRDE0003P AzureOfferCode = "MSAZRDE0003P" + AzureOfferCodeMSAZRDE0044P AzureOfferCode = "MSAZRDE0044P" + AzureOfferCodeMSAZRUSGOV0003P AzureOfferCode = "MSAZRUSGOV0003P" + AzureOfferCodeMSMCAZR0044P AzureOfferCode = "MSMCAZR0044P" + AzureOfferCodeMSMCAZR0059P AzureOfferCode = "MSMCAZR0059P" + AzureOfferCodeMSMCAZR0060P AzureOfferCode = "MSMCAZR0060P" + AzureOfferCodeMSMCAZR0063P AzureOfferCode = "MSMCAZR0063P" + AzureOfferCodeMSMCAZR0120P AzureOfferCode = "MSMCAZR0120P" + AzureOfferCodeMSMCAZR0121P AzureOfferCode = "MSMCAZR0121P" + AzureOfferCodeMSMCAZR0125P AzureOfferCode = "MSMCAZR0125P" + AzureOfferCodeMSMCAZR0128P AzureOfferCode = "MSMCAZR0128P" + AzureOfferCodeUnknown AzureOfferCode = "Unknown" +) + +// PossibleAzureOfferCodeValues returns the possible values for the AzureOfferCode const type. +func PossibleAzureOfferCodeValues() []AzureOfferCode { + return []AzureOfferCode{ + AzureOfferCodeEA, + AzureOfferCodeMSAZR0003P, + AzureOfferCodeMSAZR0022P, + AzureOfferCodeMSAZR0023P, + AzureOfferCodeMSAZR0025P, + AzureOfferCodeMSAZR0029P, + AzureOfferCodeMSAZR0036P, + AzureOfferCodeMSAZR0044P, + AzureOfferCodeMSAZR0059P, + AzureOfferCodeMSAZR0060P, + AzureOfferCodeMSAZR0062P, + AzureOfferCodeMSAZR0063P, + AzureOfferCodeMSAZR0064P, + AzureOfferCodeMSAZR0111P, + AzureOfferCodeMSAZR0120P, + AzureOfferCodeMSAZR0121P, + AzureOfferCodeMSAZR0122P, + AzureOfferCodeMSAZR0123P, + AzureOfferCodeMSAZR0124P, + AzureOfferCodeMSAZR0125P, + AzureOfferCodeMSAZR0126P, + AzureOfferCodeMSAZR0127P, + AzureOfferCodeMSAZR0128P, + AzureOfferCodeMSAZR0129P, + AzureOfferCodeMSAZR0130P, + AzureOfferCodeMSAZR0144P, + AzureOfferCodeMSAZR0148P, + AzureOfferCodeMSAZR0149P, + AzureOfferCodeMSAZRDE0003P, + AzureOfferCodeMSAZRDE0044P, + AzureOfferCodeMSAZRUSGOV0003P, + AzureOfferCodeMSMCAZR0044P, + AzureOfferCodeMSMCAZR0059P, + AzureOfferCodeMSMCAZR0060P, + AzureOfferCodeMSMCAZR0063P, + AzureOfferCodeMSMCAZR0120P, + AzureOfferCodeMSMCAZR0121P, + AzureOfferCodeMSMCAZR0125P, + AzureOfferCodeMSMCAZR0128P, + AzureOfferCodeUnknown, + } +} + +// AzurePricingTier - Pricing tier for Size evaluation. +type AzurePricingTier string + +const ( + AzurePricingTierBasic AzurePricingTier = "Basic" + AzurePricingTierStandard AzurePricingTier = "Standard" +) + +// PossibleAzurePricingTierValues returns the possible values for the AzurePricingTier const type. +func PossibleAzurePricingTierValues() []AzurePricingTier { + return []AzurePricingTier{ + AzurePricingTierBasic, + AzurePricingTierStandard, + } +} + +// AzureStorageRedundancy - Storage Redundancy type offered by Azure. +type AzureStorageRedundancy string + +const ( + AzureStorageRedundancyGeoRedundant AzureStorageRedundancy = "GeoRedundant" + AzureStorageRedundancyLocallyRedundant AzureStorageRedundancy = "LocallyRedundant" + AzureStorageRedundancyReadAccessGeoRedundant AzureStorageRedundancy = "ReadAccessGeoRedundant" + AzureStorageRedundancyUnknown AzureStorageRedundancy = "Unknown" + AzureStorageRedundancyZoneRedundant AzureStorageRedundancy = "ZoneRedundant" +) + +// PossibleAzureStorageRedundancyValues returns the possible values for the AzureStorageRedundancy const type. +func PossibleAzureStorageRedundancyValues() []AzureStorageRedundancy { + return []AzureStorageRedundancy{ + AzureStorageRedundancyGeoRedundant, + AzureStorageRedundancyLocallyRedundant, + AzureStorageRedundancyReadAccessGeoRedundant, + AzureStorageRedundancyUnknown, + AzureStorageRedundancyZoneRedundant, + } +} + +// AzureVMFamily - Azure VM family. +type AzureVMFamily string + +const ( + AzureVMFamilyAv2Series AzureVMFamily = "Av2_series" + AzureVMFamilyBasicA0A4 AzureVMFamily = "Basic_A0_A4" + AzureVMFamilyDCSeries AzureVMFamily = "DC_Series" + AzureVMFamilyDSSeries AzureVMFamily = "DS_series" + AzureVMFamilyDSeries AzureVMFamily = "D_series" + AzureVMFamilyDSv2Series AzureVMFamily = "DSv2_series" + AzureVMFamilyDsv3Series AzureVMFamily = "Dsv3_series" + AzureVMFamilyDv2Series AzureVMFamily = "Dv2_series" + AzureVMFamilyDv3Series AzureVMFamily = "Dv3_series" + AzureVMFamilyEsv3Series AzureVMFamily = "Esv3_series" + AzureVMFamilyEv3Series AzureVMFamily = "Ev3_series" + AzureVMFamilyFSeries AzureVMFamily = "F_series" + AzureVMFamilyFsSeries AzureVMFamily = "Fs_series" + AzureVMFamilyFsv2Series AzureVMFamily = "Fsv2_series" + AzureVMFamilyGSSeries AzureVMFamily = "GS_series" + AzureVMFamilyGSeries AzureVMFamily = "G_series" + AzureVMFamilyHSeries AzureVMFamily = "H_series" + AzureVMFamilyLsSeries AzureVMFamily = "Ls_series" + AzureVMFamilyMSeries AzureVMFamily = "M_series" + AzureVMFamilyStandardA0A7 AzureVMFamily = "Standard_A0_A7" + AzureVMFamilyStandardA8A11 AzureVMFamily = "Standard_A8_A11" + AzureVMFamilyUnknown AzureVMFamily = "Unknown" +) + +// PossibleAzureVMFamilyValues returns the possible values for the AzureVMFamily const type. +func PossibleAzureVMFamilyValues() []AzureVMFamily { + return []AzureVMFamily{ + AzureVMFamilyAv2Series, + AzureVMFamilyBasicA0A4, + AzureVMFamilyDCSeries, + AzureVMFamilyDSSeries, + AzureVMFamilyDSeries, + AzureVMFamilyDSv2Series, + AzureVMFamilyDsv3Series, + AzureVMFamilyDv2Series, + AzureVMFamilyDv3Series, + AzureVMFamilyEsv3Series, + AzureVMFamilyEv3Series, + AzureVMFamilyFSeries, + AzureVMFamilyFsSeries, + AzureVMFamilyFsv2Series, + AzureVMFamilyGSSeries, + AzureVMFamilyGSeries, + AzureVMFamilyHSeries, + AzureVMFamilyLsSeries, + AzureVMFamilyMSeries, + AzureVMFamilyStandardA0A7, + AzureVMFamilyStandardA8A11, + AzureVMFamilyUnknown, + } +} + +// AzureVMSize - Recommended Azure size for this machine. +type AzureVMSize string + +const ( + AzureVMSizeBasicA0 AzureVMSize = "Basic_A0" + AzureVMSizeBasicA1 AzureVMSize = "Basic_A1" + AzureVMSizeBasicA2 AzureVMSize = "Basic_A2" + AzureVMSizeBasicA3 AzureVMSize = "Basic_A3" + AzureVMSizeBasicA4 AzureVMSize = "Basic_A4" + AzureVMSizeStandardA0 AzureVMSize = "Standard_A0" + AzureVMSizeStandardA1 AzureVMSize = "Standard_A1" + AzureVMSizeStandardA10 AzureVMSize = "Standard_A10" + AzureVMSizeStandardA11 AzureVMSize = "Standard_A11" + AzureVMSizeStandardA1V2 AzureVMSize = "Standard_A1_v2" + AzureVMSizeStandardA2 AzureVMSize = "Standard_A2" + AzureVMSizeStandardA2MV2 AzureVMSize = "Standard_A2m_v2" + AzureVMSizeStandardA2V2 AzureVMSize = "Standard_A2_v2" + AzureVMSizeStandardA3 AzureVMSize = "Standard_A3" + AzureVMSizeStandardA4 AzureVMSize = "Standard_A4" + AzureVMSizeStandardA4MV2 AzureVMSize = "Standard_A4m_v2" + AzureVMSizeStandardA4V2 AzureVMSize = "Standard_A4_v2" + AzureVMSizeStandardA5 AzureVMSize = "Standard_A5" + AzureVMSizeStandardA6 AzureVMSize = "Standard_A6" + AzureVMSizeStandardA7 AzureVMSize = "Standard_A7" + AzureVMSizeStandardA8 AzureVMSize = "Standard_A8" + AzureVMSizeStandardA8MV2 AzureVMSize = "Standard_A8m_v2" + AzureVMSizeStandardA8V2 AzureVMSize = "Standard_A8_v2" + AzureVMSizeStandardA9 AzureVMSize = "Standard_A9" + AzureVMSizeStandardD1 AzureVMSize = "Standard_D1" + AzureVMSizeStandardD11 AzureVMSize = "Standard_D11" + AzureVMSizeStandardD11V2 AzureVMSize = "Standard_D11_v2" + AzureVMSizeStandardD12 AzureVMSize = "Standard_D12" + AzureVMSizeStandardD12V2 AzureVMSize = "Standard_D12_v2" + AzureVMSizeStandardD13 AzureVMSize = "Standard_D13" + AzureVMSizeStandardD13V2 AzureVMSize = "Standard_D13_v2" + AzureVMSizeStandardD14 AzureVMSize = "Standard_D14" + AzureVMSizeStandardD14V2 AzureVMSize = "Standard_D14_v2" + AzureVMSizeStandardD15V2 AzureVMSize = "Standard_D15_v2" + AzureVMSizeStandardD16SV3 AzureVMSize = "Standard_D16s_v3" + AzureVMSizeStandardD16V3 AzureVMSize = "Standard_D16_v3" + AzureVMSizeStandardD1V2 AzureVMSize = "Standard_D1_v2" + AzureVMSizeStandardD2 AzureVMSize = "Standard_D2" + AzureVMSizeStandardD2SV3 AzureVMSize = "Standard_D2s_v3" + AzureVMSizeStandardD2V2 AzureVMSize = "Standard_D2_v2" + AzureVMSizeStandardD2V3 AzureVMSize = "Standard_D2_v3" + AzureVMSizeStandardD3 AzureVMSize = "Standard_D3" + AzureVMSizeStandardD32SV3 AzureVMSize = "Standard_D32s_v3" + AzureVMSizeStandardD32V3 AzureVMSize = "Standard_D32_v3" + AzureVMSizeStandardD3V2 AzureVMSize = "Standard_D3_v2" + AzureVMSizeStandardD4 AzureVMSize = "Standard_D4" + AzureVMSizeStandardD4SV3 AzureVMSize = "Standard_D4s_v3" + AzureVMSizeStandardD4V2 AzureVMSize = "Standard_D4_v2" + AzureVMSizeStandardD4V3 AzureVMSize = "Standard_D4_v3" + AzureVMSizeStandardD5V2 AzureVMSize = "Standard_D5_v2" + AzureVMSizeStandardD64SV3 AzureVMSize = "Standard_D64s_v3" + AzureVMSizeStandardD64V3 AzureVMSize = "Standard_D64_v3" + AzureVMSizeStandardD8SV3 AzureVMSize = "Standard_D8s_v3" + AzureVMSizeStandardD8V3 AzureVMSize = "Standard_D8_v3" + AzureVMSizeStandardDS1 AzureVMSize = "Standard_DS1" + AzureVMSizeStandardDS11 AzureVMSize = "Standard_DS11" + AzureVMSizeStandardDS11V2 AzureVMSize = "Standard_DS11_v2" + AzureVMSizeStandardDS12 AzureVMSize = "Standard_DS12" + AzureVMSizeStandardDS12V2 AzureVMSize = "Standard_DS12_v2" + AzureVMSizeStandardDS13 AzureVMSize = "Standard_DS13" + AzureVMSizeStandardDS13V2 AzureVMSize = "Standard_DS13_v2" + AzureVMSizeStandardDS14 AzureVMSize = "Standard_DS14" + AzureVMSizeStandardDS14V2 AzureVMSize = "Standard_DS14_v2" + AzureVMSizeStandardDS15V2 AzureVMSize = "Standard_DS15_v2" + AzureVMSizeStandardDS1V2 AzureVMSize = "Standard_DS1_v2" + AzureVMSizeStandardDS2 AzureVMSize = "Standard_DS2" + AzureVMSizeStandardDS2V2 AzureVMSize = "Standard_DS2_v2" + AzureVMSizeStandardDS3 AzureVMSize = "Standard_DS3" + AzureVMSizeStandardDS3V2 AzureVMSize = "Standard_DS3_v2" + AzureVMSizeStandardDS4 AzureVMSize = "Standard_DS4" + AzureVMSizeStandardDS4V2 AzureVMSize = "Standard_DS4_v2" + AzureVMSizeStandardDS5V2 AzureVMSize = "Standard_DS5_v2" + AzureVMSizeStandardE16SV3 AzureVMSize = "Standard_E16s_v3" + AzureVMSizeStandardE16V3 AzureVMSize = "Standard_E16_v3" + AzureVMSizeStandardE2SV3 AzureVMSize = "Standard_E2s_v3" + AzureVMSizeStandardE2V3 AzureVMSize = "Standard_E2_v3" + AzureVMSizeStandardE32SV3 AzureVMSize = "Standard_E32s_v3" + AzureVMSizeStandardE32V3 AzureVMSize = "Standard_E32_v3" + AzureVMSizeStandardE4SV3 AzureVMSize = "Standard_E4s_v3" + AzureVMSizeStandardE4V3 AzureVMSize = "Standard_E4_v3" + AzureVMSizeStandardE64SV3 AzureVMSize = "Standard_E64s_v3" + AzureVMSizeStandardE64V3 AzureVMSize = "Standard_E64_v3" + AzureVMSizeStandardE8SV3 AzureVMSize = "Standard_E8s_v3" + AzureVMSizeStandardE8V3 AzureVMSize = "Standard_E8_v3" + AzureVMSizeStandardF1 AzureVMSize = "Standard_F1" + AzureVMSizeStandardF16 AzureVMSize = "Standard_F16" + AzureVMSizeStandardF16S AzureVMSize = "Standard_F16s" + AzureVMSizeStandardF16SV2 AzureVMSize = "Standard_F16s_v2" + AzureVMSizeStandardF1S AzureVMSize = "Standard_F1s" + AzureVMSizeStandardF2 AzureVMSize = "Standard_F2" + AzureVMSizeStandardF2S AzureVMSize = "Standard_F2s" + AzureVMSizeStandardF2SV2 AzureVMSize = "Standard_F2s_v2" + AzureVMSizeStandardF32SV2 AzureVMSize = "Standard_F32s_v2" + AzureVMSizeStandardF4 AzureVMSize = "Standard_F4" + AzureVMSizeStandardF4S AzureVMSize = "Standard_F4s" + AzureVMSizeStandardF4SV2 AzureVMSize = "Standard_F4s_v2" + AzureVMSizeStandardF64SV2 AzureVMSize = "Standard_F64s_v2" + AzureVMSizeStandardF72SV2 AzureVMSize = "Standard_F72s_v2" + AzureVMSizeStandardF8 AzureVMSize = "Standard_F8" + AzureVMSizeStandardF8S AzureVMSize = "Standard_F8s" + AzureVMSizeStandardF8SV2 AzureVMSize = "Standard_F8s_v2" + AzureVMSizeStandardG1 AzureVMSize = "Standard_G1" + AzureVMSizeStandardG2 AzureVMSize = "Standard_G2" + AzureVMSizeStandardG3 AzureVMSize = "Standard_G3" + AzureVMSizeStandardG4 AzureVMSize = "Standard_G4" + AzureVMSizeStandardG5 AzureVMSize = "Standard_G5" + AzureVMSizeStandardGS1 AzureVMSize = "Standard_GS1" + AzureVMSizeStandardGS2 AzureVMSize = "Standard_GS2" + AzureVMSizeStandardGS3 AzureVMSize = "Standard_GS3" + AzureVMSizeStandardGS4 AzureVMSize = "Standard_GS4" + AzureVMSizeStandardGS5 AzureVMSize = "Standard_GS5" + AzureVMSizeStandardH16 AzureVMSize = "Standard_H16" + AzureVMSizeStandardH16M AzureVMSize = "Standard_H16m" + AzureVMSizeStandardH16Mr AzureVMSize = "Standard_H16mr" + AzureVMSizeStandardH16R AzureVMSize = "Standard_H16r" + AzureVMSizeStandardH8 AzureVMSize = "Standard_H8" + AzureVMSizeStandardH8M AzureVMSize = "Standard_H8m" + AzureVMSizeStandardL16S AzureVMSize = "Standard_L16s" + AzureVMSizeStandardL32S AzureVMSize = "Standard_L32s" + AzureVMSizeStandardL4S AzureVMSize = "Standard_L4s" + AzureVMSizeStandardL8S AzureVMSize = "Standard_L8s" + AzureVMSizeStandardM128Ms AzureVMSize = "Standard_M128ms" + AzureVMSizeStandardM128S AzureVMSize = "Standard_M128s" + AzureVMSizeStandardM64Ms AzureVMSize = "Standard_M64ms" + AzureVMSizeStandardM64S AzureVMSize = "Standard_M64s" + AzureVMSizeUnknown AzureVMSize = "Unknown" +) + +// PossibleAzureVMSizeValues returns the possible values for the AzureVMSize const type. +func PossibleAzureVMSizeValues() []AzureVMSize { + return []AzureVMSize{ + AzureVMSizeBasicA0, + AzureVMSizeBasicA1, + AzureVMSizeBasicA2, + AzureVMSizeBasicA3, + AzureVMSizeBasicA4, + AzureVMSizeStandardA0, + AzureVMSizeStandardA1, + AzureVMSizeStandardA10, + AzureVMSizeStandardA11, + AzureVMSizeStandardA1V2, + AzureVMSizeStandardA2, + AzureVMSizeStandardA2MV2, + AzureVMSizeStandardA2V2, + AzureVMSizeStandardA3, + AzureVMSizeStandardA4, + AzureVMSizeStandardA4MV2, + AzureVMSizeStandardA4V2, + AzureVMSizeStandardA5, + AzureVMSizeStandardA6, + AzureVMSizeStandardA7, + AzureVMSizeStandardA8, + AzureVMSizeStandardA8MV2, + AzureVMSizeStandardA8V2, + AzureVMSizeStandardA9, + AzureVMSizeStandardD1, + AzureVMSizeStandardD11, + AzureVMSizeStandardD11V2, + AzureVMSizeStandardD12, + AzureVMSizeStandardD12V2, + AzureVMSizeStandardD13, + AzureVMSizeStandardD13V2, + AzureVMSizeStandardD14, + AzureVMSizeStandardD14V2, + AzureVMSizeStandardD15V2, + AzureVMSizeStandardD16SV3, + AzureVMSizeStandardD16V3, + AzureVMSizeStandardD1V2, + AzureVMSizeStandardD2, + AzureVMSizeStandardD2SV3, + AzureVMSizeStandardD2V2, + AzureVMSizeStandardD2V3, + AzureVMSizeStandardD3, + AzureVMSizeStandardD32SV3, + AzureVMSizeStandardD32V3, + AzureVMSizeStandardD3V2, + AzureVMSizeStandardD4, + AzureVMSizeStandardD4SV3, + AzureVMSizeStandardD4V2, + AzureVMSizeStandardD4V3, + AzureVMSizeStandardD5V2, + AzureVMSizeStandardD64SV3, + AzureVMSizeStandardD64V3, + AzureVMSizeStandardD8SV3, + AzureVMSizeStandardD8V3, + AzureVMSizeStandardDS1, + AzureVMSizeStandardDS11, + AzureVMSizeStandardDS11V2, + AzureVMSizeStandardDS12, + AzureVMSizeStandardDS12V2, + AzureVMSizeStandardDS13, + AzureVMSizeStandardDS13V2, + AzureVMSizeStandardDS14, + AzureVMSizeStandardDS14V2, + AzureVMSizeStandardDS15V2, + AzureVMSizeStandardDS1V2, + AzureVMSizeStandardDS2, + AzureVMSizeStandardDS2V2, + AzureVMSizeStandardDS3, + AzureVMSizeStandardDS3V2, + AzureVMSizeStandardDS4, + AzureVMSizeStandardDS4V2, + AzureVMSizeStandardDS5V2, + AzureVMSizeStandardE16SV3, + AzureVMSizeStandardE16V3, + AzureVMSizeStandardE2SV3, + AzureVMSizeStandardE2V3, + AzureVMSizeStandardE32SV3, + AzureVMSizeStandardE32V3, + AzureVMSizeStandardE4SV3, + AzureVMSizeStandardE4V3, + AzureVMSizeStandardE64SV3, + AzureVMSizeStandardE64V3, + AzureVMSizeStandardE8SV3, + AzureVMSizeStandardE8V3, + AzureVMSizeStandardF1, + AzureVMSizeStandardF16, + AzureVMSizeStandardF16S, + AzureVMSizeStandardF16SV2, + AzureVMSizeStandardF1S, + AzureVMSizeStandardF2, + AzureVMSizeStandardF2S, + AzureVMSizeStandardF2SV2, + AzureVMSizeStandardF32SV2, + AzureVMSizeStandardF4, + AzureVMSizeStandardF4S, + AzureVMSizeStandardF4SV2, + AzureVMSizeStandardF64SV2, + AzureVMSizeStandardF72SV2, + AzureVMSizeStandardF8, + AzureVMSizeStandardF8S, + AzureVMSizeStandardF8SV2, + AzureVMSizeStandardG1, + AzureVMSizeStandardG2, + AzureVMSizeStandardG3, + AzureVMSizeStandardG4, + AzureVMSizeStandardG5, + AzureVMSizeStandardGS1, + AzureVMSizeStandardGS2, + AzureVMSizeStandardGS3, + AzureVMSizeStandardGS4, + AzureVMSizeStandardGS5, + AzureVMSizeStandardH16, + AzureVMSizeStandardH16M, + AzureVMSizeStandardH16Mr, + AzureVMSizeStandardH16R, + AzureVMSizeStandardH8, + AzureVMSizeStandardH8M, + AzureVMSizeStandardL16S, + AzureVMSizeStandardL32S, + AzureVMSizeStandardL4S, + AzureVMSizeStandardL8S, + AzureVMSizeStandardM128Ms, + AzureVMSizeStandardM128S, + AzureVMSizeStandardM64Ms, + AzureVMSizeStandardM64S, + AzureVMSizeUnknown, + } +} + +// AzureVMSuitabilityDetail - If machine is not suitable for cloud, this explains the reasons. +type AzureVMSuitabilityDetail string + +const ( + AzureVMSuitabilityDetailCannotReportBandwidthCosts AzureVMSuitabilityDetail = "CannotReportBandwidthCosts" + AzureVMSuitabilityDetailCannotReportComputeCost AzureVMSuitabilityDetail = "CannotReportComputeCost" + AzureVMSuitabilityDetailCannotReportStorageCost AzureVMSuitabilityDetail = "CannotReportStorageCost" + AzureVMSuitabilityDetailNone AzureVMSuitabilityDetail = "None" + AzureVMSuitabilityDetailPercentageOfCoresUtilizedMissing AzureVMSuitabilityDetail = "PercentageOfCoresUtilizedMissing" + AzureVMSuitabilityDetailPercentageOfCoresUtilizedOutOfRange AzureVMSuitabilityDetail = "PercentageOfCoresUtilizedOutOfRange" + AzureVMSuitabilityDetailPercentageOfMemoryUtilizedMissing AzureVMSuitabilityDetail = "PercentageOfMemoryUtilizedMissing" + AzureVMSuitabilityDetailPercentageOfMemoryUtilizedOutOfRange AzureVMSuitabilityDetail = "PercentageOfMemoryUtilizedOutOfRange" + AzureVMSuitabilityDetailRecommendedSizeHasLessNetworkAdapters AzureVMSuitabilityDetail = "RecommendedSizeHasLessNetworkAdapters" +) + +// PossibleAzureVMSuitabilityDetailValues returns the possible values for the AzureVMSuitabilityDetail const type. +func PossibleAzureVMSuitabilityDetailValues() []AzureVMSuitabilityDetail { + return []AzureVMSuitabilityDetail{ + AzureVMSuitabilityDetailCannotReportBandwidthCosts, + AzureVMSuitabilityDetailCannotReportComputeCost, + AzureVMSuitabilityDetailCannotReportStorageCost, + AzureVMSuitabilityDetailNone, + AzureVMSuitabilityDetailPercentageOfCoresUtilizedMissing, + AzureVMSuitabilityDetailPercentageOfCoresUtilizedOutOfRange, + AzureVMSuitabilityDetailPercentageOfMemoryUtilizedMissing, + AzureVMSuitabilityDetailPercentageOfMemoryUtilizedOutOfRange, + AzureVMSuitabilityDetailRecommendedSizeHasLessNetworkAdapters, + } +} + +// AzureVMSuitabilityExplanation - If machine is not ready to be migrated, this explains the reasons and mitigation steps. +type AzureVMSuitabilityExplanation string + +const ( + AzureVMSuitabilityExplanationBootTypeNotSupported AzureVMSuitabilityExplanation = "BootTypeNotSupported" + AzureVMSuitabilityExplanationBootTypeUnknown AzureVMSuitabilityExplanation = "BootTypeUnknown" + AzureVMSuitabilityExplanationCheckCentOsVersion AzureVMSuitabilityExplanation = "CheckCentOsVersion" + AzureVMSuitabilityExplanationCheckCoreOsLinuxVersion AzureVMSuitabilityExplanation = "CheckCoreOsLinuxVersion" + AzureVMSuitabilityExplanationCheckDebianLinuxVersion AzureVMSuitabilityExplanation = "CheckDebianLinuxVersion" + AzureVMSuitabilityExplanationCheckOpenSuseLinuxVersion AzureVMSuitabilityExplanation = "CheckOpenSuseLinuxVersion" + AzureVMSuitabilityExplanationCheckOracleLinuxVersion AzureVMSuitabilityExplanation = "CheckOracleLinuxVersion" + AzureVMSuitabilityExplanationCheckRedHatLinuxVersion AzureVMSuitabilityExplanation = "CheckRedHatLinuxVersion" + AzureVMSuitabilityExplanationCheckSuseLinuxVersion AzureVMSuitabilityExplanation = "CheckSuseLinuxVersion" + AzureVMSuitabilityExplanationCheckUbuntuLinuxVersion AzureVMSuitabilityExplanation = "CheckUbuntuLinuxVersion" + AzureVMSuitabilityExplanationCheckWindowsServer2008R2Version AzureVMSuitabilityExplanation = "CheckWindowsServer2008R2Version" + AzureVMSuitabilityExplanationEndorsedWithConditionsLinuxDistributions AzureVMSuitabilityExplanation = "EndorsedWithConditionsLinuxDistributions" + AzureVMSuitabilityExplanationGuestOperatingSystemArchitectureNotSupported AzureVMSuitabilityExplanation = "GuestOperatingSystemArchitectureNotSupported" + AzureVMSuitabilityExplanationGuestOperatingSystemNotSupported AzureVMSuitabilityExplanation = "GuestOperatingSystemNotSupported" + AzureVMSuitabilityExplanationGuestOperatingSystemUnknown AzureVMSuitabilityExplanation = "GuestOperatingSystemUnknown" + AzureVMSuitabilityExplanationInternalErrorOccurredDuringComputeEvaluation AzureVMSuitabilityExplanation = "InternalErrorOccurredDuringComputeEvaluation" + AzureVMSuitabilityExplanationInternalErrorOccurredDuringNetworkEvaluation AzureVMSuitabilityExplanation = "InternalErrorOccurredDuringNetworkEvaluation" + AzureVMSuitabilityExplanationInternalErrorOccurredDuringStorageEvaluation AzureVMSuitabilityExplanation = "InternalErrorOccurredDuringStorageEvaluation" + AzureVMSuitabilityExplanationMoreDisksThanSupported AzureVMSuitabilityExplanation = "MoreDisksThanSupported" + AzureVMSuitabilityExplanationNoGuestOperatingSystemConditionallySupported AzureVMSuitabilityExplanation = "NoGuestOperatingSystemConditionallySupported" + AzureVMSuitabilityExplanationNoSuitableVMSizeFound AzureVMSuitabilityExplanation = "NoSuitableVmSizeFound" + AzureVMSuitabilityExplanationNoVMSizeForBasicPricingTier AzureVMSuitabilityExplanation = "NoVmSizeForBasicPricingTier" + AzureVMSuitabilityExplanationNoVMSizeForSelectedAzureLocation AzureVMSuitabilityExplanation = "NoVmSizeForSelectedAzureLocation" + AzureVMSuitabilityExplanationNoVMSizeForSelectedPricingTier AzureVMSuitabilityExplanation = "NoVmSizeForSelectedPricingTier" + AzureVMSuitabilityExplanationNoVMSizeForStandardPricingTier AzureVMSuitabilityExplanation = "NoVmSizeForStandardPricingTier" + AzureVMSuitabilityExplanationNoVMSizeSupportsNetworkPerformance AzureVMSuitabilityExplanation = "NoVmSizeSupportsNetworkPerformance" + AzureVMSuitabilityExplanationNoVMSizeSupportsStoragePerformance AzureVMSuitabilityExplanation = "NoVmSizeSupportsStoragePerformance" + AzureVMSuitabilityExplanationNotApplicable AzureVMSuitabilityExplanation = "NotApplicable" + AzureVMSuitabilityExplanationOneOrMoreAdaptersNotSuitable AzureVMSuitabilityExplanation = "OneOrMoreAdaptersNotSuitable" + AzureVMSuitabilityExplanationOneOrMoreDisksNotSuitable AzureVMSuitabilityExplanation = "OneOrMoreDisksNotSuitable" + AzureVMSuitabilityExplanationUnendorsedLinuxDistributions AzureVMSuitabilityExplanation = "UnendorsedLinuxDistributions" + AzureVMSuitabilityExplanationUnknown AzureVMSuitabilityExplanation = "Unknown" + AzureVMSuitabilityExplanationWindowsClientVersionsConditionallySupported AzureVMSuitabilityExplanation = "WindowsClientVersionsConditionallySupported" + AzureVMSuitabilityExplanationWindowsOSNoLongerUnderMSSupport AzureVMSuitabilityExplanation = "WindowsOSNoLongerUnderMSSupport" + AzureVMSuitabilityExplanationWindowsServerVersionConditionallySupported AzureVMSuitabilityExplanation = "WindowsServerVersionConditionallySupported" + AzureVMSuitabilityExplanationWindowsServerVersionsSupportedWithCaveat AzureVMSuitabilityExplanation = "WindowsServerVersionsSupportedWithCaveat" +) + +// PossibleAzureVMSuitabilityExplanationValues returns the possible values for the AzureVMSuitabilityExplanation const type. +func PossibleAzureVMSuitabilityExplanationValues() []AzureVMSuitabilityExplanation { + return []AzureVMSuitabilityExplanation{ + AzureVMSuitabilityExplanationBootTypeNotSupported, + AzureVMSuitabilityExplanationBootTypeUnknown, + AzureVMSuitabilityExplanationCheckCentOsVersion, + AzureVMSuitabilityExplanationCheckCoreOsLinuxVersion, + AzureVMSuitabilityExplanationCheckDebianLinuxVersion, + AzureVMSuitabilityExplanationCheckOpenSuseLinuxVersion, + AzureVMSuitabilityExplanationCheckOracleLinuxVersion, + AzureVMSuitabilityExplanationCheckRedHatLinuxVersion, + AzureVMSuitabilityExplanationCheckSuseLinuxVersion, + AzureVMSuitabilityExplanationCheckUbuntuLinuxVersion, + AzureVMSuitabilityExplanationCheckWindowsServer2008R2Version, + AzureVMSuitabilityExplanationEndorsedWithConditionsLinuxDistributions, + AzureVMSuitabilityExplanationGuestOperatingSystemArchitectureNotSupported, + AzureVMSuitabilityExplanationGuestOperatingSystemNotSupported, + AzureVMSuitabilityExplanationGuestOperatingSystemUnknown, + AzureVMSuitabilityExplanationInternalErrorOccurredDuringComputeEvaluation, + AzureVMSuitabilityExplanationInternalErrorOccurredDuringNetworkEvaluation, + AzureVMSuitabilityExplanationInternalErrorOccurredDuringStorageEvaluation, + AzureVMSuitabilityExplanationMoreDisksThanSupported, + AzureVMSuitabilityExplanationNoGuestOperatingSystemConditionallySupported, + AzureVMSuitabilityExplanationNoSuitableVMSizeFound, + AzureVMSuitabilityExplanationNoVMSizeForBasicPricingTier, + AzureVMSuitabilityExplanationNoVMSizeForSelectedAzureLocation, + AzureVMSuitabilityExplanationNoVMSizeForSelectedPricingTier, + AzureVMSuitabilityExplanationNoVMSizeForStandardPricingTier, + AzureVMSuitabilityExplanationNoVMSizeSupportsNetworkPerformance, + AzureVMSuitabilityExplanationNoVMSizeSupportsStoragePerformance, + AzureVMSuitabilityExplanationNotApplicable, + AzureVMSuitabilityExplanationOneOrMoreAdaptersNotSuitable, + AzureVMSuitabilityExplanationOneOrMoreDisksNotSuitable, + AzureVMSuitabilityExplanationUnendorsedLinuxDistributions, + AzureVMSuitabilityExplanationUnknown, + AzureVMSuitabilityExplanationWindowsClientVersionsConditionallySupported, + AzureVMSuitabilityExplanationWindowsOSNoLongerUnderMSSupport, + AzureVMSuitabilityExplanationWindowsServerVersionConditionallySupported, + AzureVMSuitabilityExplanationWindowsServerVersionsSupportedWithCaveat, + } +} + +// CloudSuitability - Whether this disk is suitable for Azure. +type CloudSuitability string + +const ( + CloudSuitabilityConditionallySuitable CloudSuitability = "ConditionallySuitable" + CloudSuitabilityNotSuitable CloudSuitability = "NotSuitable" + CloudSuitabilityReadinessUnknown CloudSuitability = "ReadinessUnknown" + CloudSuitabilitySuitable CloudSuitability = "Suitable" + CloudSuitabilityUnknown CloudSuitability = "Unknown" +) + +// PossibleCloudSuitabilityValues returns the possible values for the CloudSuitability const type. +func PossibleCloudSuitabilityValues() []CloudSuitability { + return []CloudSuitability{ + CloudSuitabilityConditionallySuitable, + CloudSuitabilityNotSuitable, + CloudSuitabilityReadinessUnknown, + CloudSuitabilitySuitable, + CloudSuitabilityUnknown, + } +} + +// Currency - Currency to report prices in. +type Currency string + +const ( + CurrencyARS Currency = "ARS" + CurrencyAUD Currency = "AUD" + CurrencyBRL Currency = "BRL" + CurrencyCAD Currency = "CAD" + CurrencyCHF Currency = "CHF" + CurrencyCNY Currency = "CNY" + CurrencyDKK Currency = "DKK" + CurrencyEUR Currency = "EUR" + CurrencyGBP Currency = "GBP" + CurrencyHKD Currency = "HKD" + CurrencyIDR Currency = "IDR" + CurrencyINR Currency = "INR" + CurrencyJPY Currency = "JPY" + CurrencyKRW Currency = "KRW" + CurrencyMXN Currency = "MXN" + CurrencyMYR Currency = "MYR" + CurrencyNOK Currency = "NOK" + CurrencyNZD Currency = "NZD" + CurrencyRUB Currency = "RUB" + CurrencySAR Currency = "SAR" + CurrencySEK Currency = "SEK" + CurrencyTRY Currency = "TRY" + CurrencyTWD Currency = "TWD" + CurrencyUSD Currency = "USD" + CurrencyUnknown Currency = "Unknown" + CurrencyZAR Currency = "ZAR" +) + +// PossibleCurrencyValues returns the possible values for the Currency const type. +func PossibleCurrencyValues() []Currency { + return []Currency{ + CurrencyARS, + CurrencyAUD, + CurrencyBRL, + CurrencyCAD, + CurrencyCHF, + CurrencyCNY, + CurrencyDKK, + CurrencyEUR, + CurrencyGBP, + CurrencyHKD, + CurrencyIDR, + CurrencyINR, + CurrencyJPY, + CurrencyKRW, + CurrencyMXN, + CurrencyMYR, + CurrencyNOK, + CurrencyNZD, + CurrencyRUB, + CurrencySAR, + CurrencySEK, + CurrencyTRY, + CurrencyTWD, + CurrencyUSD, + CurrencyUnknown, + CurrencyZAR, + } +} + +// GroupStatus - Whether the group has been created and is valid. +type GroupStatus string + +const ( + GroupStatusCompleted GroupStatus = "Completed" + GroupStatusCreated GroupStatus = "Created" + GroupStatusInvalid GroupStatus = "Invalid" + GroupStatusRunning GroupStatus = "Running" + GroupStatusUpdated GroupStatus = "Updated" +) + +// PossibleGroupStatusValues returns the possible values for the GroupStatus const type. +func PossibleGroupStatusValues() []GroupStatus { + return []GroupStatus{ + GroupStatusCompleted, + GroupStatusCreated, + GroupStatusInvalid, + GroupStatusRunning, + GroupStatusUpdated, + } +} + +// GroupUpdateOperation - Whether to add or remove the machines. +type GroupUpdateOperation string + +const ( + GroupUpdateOperationAdd GroupUpdateOperation = "Add" + GroupUpdateOperationRemove GroupUpdateOperation = "Remove" +) + +// PossibleGroupUpdateOperationValues returns the possible values for the GroupUpdateOperation const type. +func PossibleGroupUpdateOperationValues() []GroupUpdateOperation { + return []GroupUpdateOperation{ + GroupUpdateOperationAdd, + GroupUpdateOperationRemove, + } +} + +// MachineBootType - Boot type of the machine. +type MachineBootType string + +const ( + MachineBootTypeBIOS MachineBootType = "BIOS" + MachineBootTypeEFI MachineBootType = "EFI" + MachineBootTypeUnknown MachineBootType = "Unknown" +) + +// PossibleMachineBootTypeValues returns the possible values for the MachineBootType const type. +func PossibleMachineBootTypeValues() []MachineBootType { + return []MachineBootType{ + MachineBootTypeBIOS, + MachineBootTypeEFI, + MachineBootTypeUnknown, + } +} + +// Percentile - Percentile of performance data used to recommend Azure size. +type Percentile string + +const ( + PercentilePercentile50 Percentile = "Percentile50" + PercentilePercentile90 Percentile = "Percentile90" + PercentilePercentile95 Percentile = "Percentile95" + PercentilePercentile99 Percentile = "Percentile99" +) + +// PossiblePercentileValues returns the possible values for the Percentile const type. +func PossiblePercentileValues() []Percentile { + return []Percentile{ + PercentilePercentile50, + PercentilePercentile90, + PercentilePercentile95, + PercentilePercentile99, + } +} + +// PrivateEndpointConnectionPropertiesProvisioningState - Indicates whether there is an ongoing operation on the private endpoint. +type PrivateEndpointConnectionPropertiesProvisioningState string + +const ( + PrivateEndpointConnectionPropertiesProvisioningStateAccepted PrivateEndpointConnectionPropertiesProvisioningState = "Accepted" + PrivateEndpointConnectionPropertiesProvisioningStateFailed PrivateEndpointConnectionPropertiesProvisioningState = "Failed" + PrivateEndpointConnectionPropertiesProvisioningStateInProgress PrivateEndpointConnectionPropertiesProvisioningState = "InProgress" + PrivateEndpointConnectionPropertiesProvisioningStateSucceeded PrivateEndpointConnectionPropertiesProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionPropertiesProvisioningStateValues returns the possible values for the PrivateEndpointConnectionPropertiesProvisioningState const type. +func PossiblePrivateEndpointConnectionPropertiesProvisioningStateValues() []PrivateEndpointConnectionPropertiesProvisioningState { + return []PrivateEndpointConnectionPropertiesProvisioningState{ + PrivateEndpointConnectionPropertiesProvisioningStateAccepted, + PrivateEndpointConnectionPropertiesProvisioningStateFailed, + PrivateEndpointConnectionPropertiesProvisioningStateInProgress, + PrivateEndpointConnectionPropertiesProvisioningStateSucceeded, + } +} + +// PrivateLinkServiceConnectionStateStatus - Connection status of the private endpoint connection. +type PrivateLinkServiceConnectionStateStatus string + +const ( + PrivateLinkServiceConnectionStateStatusApproved PrivateLinkServiceConnectionStateStatus = "Approved" + PrivateLinkServiceConnectionStateStatusDisconnected PrivateLinkServiceConnectionStateStatus = "Disconnected" + PrivateLinkServiceConnectionStateStatusPending PrivateLinkServiceConnectionStateStatus = "Pending" + PrivateLinkServiceConnectionStateStatusRejected PrivateLinkServiceConnectionStateStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStateStatusValues returns the possible values for the PrivateLinkServiceConnectionStateStatus const type. +func PossiblePrivateLinkServiceConnectionStateStatusValues() []PrivateLinkServiceConnectionStateStatus { + return []PrivateLinkServiceConnectionStateStatus{ + PrivateLinkServiceConnectionStateStatusApproved, + PrivateLinkServiceConnectionStateStatusDisconnected, + PrivateLinkServiceConnectionStateStatusPending, + PrivateLinkServiceConnectionStateStatusRejected, + } +} + +// ProjectStatus - Assessment project status. +type ProjectStatus string + +const ( + ProjectStatusActive ProjectStatus = "Active" + ProjectStatusInactive ProjectStatus = "Inactive" +) + +// PossibleProjectStatusValues returns the possible values for the ProjectStatus const type. +func PossibleProjectStatusValues() []ProjectStatus { + return []ProjectStatus{ + ProjectStatusActive, + ProjectStatusInactive, + } +} + +// ProvisioningState - Provisioning state of the project. +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateMoving ProvisioningState = "Moving" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateMoving, + ProvisioningStateSucceeded, + } +} + +// ReservedInstance - Azure reserved instance. +type ReservedInstance string + +const ( + ReservedInstanceNone ReservedInstance = "None" + ReservedInstanceRI1Year ReservedInstance = "RI1Year" + ReservedInstanceRI3Year ReservedInstance = "RI3Year" +) + +// PossibleReservedInstanceValues returns the possible values for the ReservedInstance const type. +func PossibleReservedInstanceValues() []ReservedInstance { + return []ReservedInstance{ + ReservedInstanceNone, + ReservedInstanceRI1Year, + ReservedInstanceRI3Year, + } +} + +// TimeRange - Time range of performance data used to recommend a size. +type TimeRange string + +const ( + TimeRangeCustom TimeRange = "Custom" + TimeRangeDay TimeRange = "Day" + TimeRangeMonth TimeRange = "Month" + TimeRangeWeek TimeRange = "Week" +) + +// PossibleTimeRangeValues returns the possible values for the TimeRange const type. +func PossibleTimeRangeValues() []TimeRange { + return []TimeRange{ + TimeRangeCustom, + TimeRangeDay, + TimeRangeMonth, + TimeRangeWeek, + } +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_groups_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_groups_client.go new file mode 100644 index 000000000000..550ecdeae494 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_groups_client.go @@ -0,0 +1,386 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// GroupsClient contains the methods for the Groups group. +// Don't use this type directly, use NewGroupsClient() instead. +type GroupsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewGroupsClient creates a new instance of GroupsClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GroupsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GroupsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Create - Create a new group by sending a json object of type 'group' as given in Models section as part of the Request +// Body. The group name in a project is unique. +// This operation is Idempotent. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// options - GroupsClientCreateOptions contains the optional parameters for the GroupsClient.Create method. +func (client *GroupsClient) Create(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientCreateOptions) (GroupsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, groupName, options) + if err != nil { + return GroupsClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GroupsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return GroupsClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *GroupsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Group != nil { + return req, runtime.MarshalAsJSON(req, *options.Group) + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *GroupsClient) createHandleResponse(resp *http.Response) (GroupsClientCreateResponse, error) { + result := GroupsClientCreateResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { + return GroupsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete the group from the project. The machines remain in the project. Deleting a non-existent group results in +// a no-operation. +// A group is an aggregation mechanism for machines in a project. Therefore, deleting group does not delete machines in it. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// options - GroupsClientDeleteOptions contains the optional parameters for the GroupsClient.Delete method. +func (client *GroupsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientDeleteOptions) (GroupsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, groupName, options) + if err != nil { + return GroupsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GroupsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return GroupsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return client.deleteHandleResponse(resp) +} + +// deleteCreateRequest creates the Delete request. +func (client *GroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *GroupsClient) deleteHandleResponse(resp *http.Response) (GroupsClientDeleteResponse, error) { + result := GroupsClientDeleteResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + return result, nil +} + +// Get - Get information related to a specific group in the project. Returns a json object of type 'group' as specified in +// the models section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// options - GroupsClientGetOptions contains the optional parameters for the GroupsClient.Get method. +func (client *GroupsClient) Get(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientGetOptions) (GroupsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, groupName, options) + if err != nil { + return GroupsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GroupsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GroupsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GroupsClient) getHandleResponse(resp *http.Response) (GroupsClientGetResponse, error) { + result := GroupsClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { + return GroupsClientGetResponse{}, err + } + return result, nil +} + +// NewListByProjectPager - Get all groups created in the project. Returns a json array of objects of type 'group' as specified +// in the Models section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - GroupsClientListByProjectOptions contains the optional parameters for the GroupsClient.ListByProject method. +func (client *GroupsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *GroupsClientListByProjectOptions) *runtime.Pager[GroupsClientListByProjectResponse] { + return runtime.NewPager(runtime.PagingHandler[GroupsClientListByProjectResponse]{ + More: func(page GroupsClientListByProjectResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *GroupsClientListByProjectResponse) (GroupsClientListByProjectResponse, error) { + req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return GroupsClientListByProjectResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GroupsClientListByProjectResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GroupsClientListByProjectResponse{}, runtime.NewResponseError(resp) + } + return client.listByProjectHandleResponse(resp) + }, + }) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *GroupsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *GroupsClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *GroupsClient) listByProjectHandleResponse(resp *http.Response) (GroupsClientListByProjectResponse, error) { + result := GroupsClientListByProjectResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.GroupResultList); err != nil { + return GroupsClientListByProjectResponse{}, err + } + return result, nil +} + +// UpdateMachines - Update machines in group by adding or removing machines. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// groupName - Unique name of a group within a project. +// options - GroupsClientUpdateMachinesOptions contains the optional parameters for the GroupsClient.UpdateMachines method. +func (client *GroupsClient) UpdateMachines(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientUpdateMachinesOptions) (GroupsClientUpdateMachinesResponse, error) { + req, err := client.updateMachinesCreateRequest(ctx, resourceGroupName, projectName, groupName, options) + if err != nil { + return GroupsClientUpdateMachinesResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GroupsClientUpdateMachinesResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GroupsClientUpdateMachinesResponse{}, runtime.NewResponseError(resp) + } + return client.updateMachinesHandleResponse(resp) +} + +// updateMachinesCreateRequest creates the UpdateMachines request. +func (client *GroupsClient) updateMachinesCreateRequest(ctx context.Context, resourceGroupName string, projectName string, groupName string, options *GroupsClientUpdateMachinesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/updateMachines" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.GroupUpdateProperties != nil { + return req, runtime.MarshalAsJSON(req, *options.GroupUpdateProperties) + } + return req, nil +} + +// updateMachinesHandleResponse handles the UpdateMachines response. +func (client *GroupsClient) updateMachinesHandleResponse(resp *http.Response) (GroupsClientUpdateMachinesResponse, error) { + result := GroupsClientUpdateMachinesResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Group); err != nil { + return GroupsClientUpdateMachinesResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_hypervcollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_hypervcollectors_client.go new file mode 100644 index 000000000000..6a4c6dd37ae2 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_hypervcollectors_client.go @@ -0,0 +1,314 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// HyperVCollectorsClient contains the methods for the HyperVCollectors group. +// Don't use this type directly, use NewHyperVCollectorsClient() instead. +type HyperVCollectorsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewHyperVCollectorsClient creates a new instance of HyperVCollectorsClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewHyperVCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HyperVCollectorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &HyperVCollectorsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Create - Create or Update Hyper-V collector +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// hyperVCollectorName - Unique name of a Hyper-V collector within a project. +// options - HyperVCollectorsClientCreateOptions contains the optional parameters for the HyperVCollectorsClient.Create method. +func (client *HyperVCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientCreateOptions) (HyperVCollectorsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, hyperVCollectorName, options) + if err != nil { + return HyperVCollectorsClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HyperVCollectorsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return HyperVCollectorsClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *HyperVCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hyperVCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if hyperVCollectorName == "" { + return nil, errors.New("parameter hyperVCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hyperVCollectorName}", url.PathEscape(hyperVCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.CollectorBody != nil { + return req, runtime.MarshalAsJSON(req, *options.CollectorBody) + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *HyperVCollectorsClient) createHandleResponse(resp *http.Response) (HyperVCollectorsClientCreateResponse, error) { + result := HyperVCollectorsClientCreateResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.HyperVCollector); err != nil { + return HyperVCollectorsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Hyper-V collector from the project. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// hyperVCollectorName - Unique name of a Hyper-V collector within a project. +// options - HyperVCollectorsClientDeleteOptions contains the optional parameters for the HyperVCollectorsClient.Delete method. +func (client *HyperVCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientDeleteOptions) (HyperVCollectorsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, hyperVCollectorName, options) + if err != nil { + return HyperVCollectorsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HyperVCollectorsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return HyperVCollectorsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return client.deleteHandleResponse(resp) +} + +// deleteCreateRequest creates the Delete request. +func (client *HyperVCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hyperVCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if hyperVCollectorName == "" { + return nil, errors.New("parameter hyperVCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hyperVCollectorName}", url.PathEscape(hyperVCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *HyperVCollectorsClient) deleteHandleResponse(resp *http.Response) (HyperVCollectorsClientDeleteResponse, error) { + result := HyperVCollectorsClientDeleteResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + return result, nil +} + +// Get - Get a Hyper-V collector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// hyperVCollectorName - Unique name of a Hyper-V collector within a project. +// options - HyperVCollectorsClientGetOptions contains the optional parameters for the HyperVCollectorsClient.Get method. +func (client *HyperVCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientGetOptions) (HyperVCollectorsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, hyperVCollectorName, options) + if err != nil { + return HyperVCollectorsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HyperVCollectorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HyperVCollectorsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *HyperVCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, hyperVCollectorName string, options *HyperVCollectorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors/{hyperVCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if hyperVCollectorName == "" { + return nil, errors.New("parameter hyperVCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{hyperVCollectorName}", url.PathEscape(hyperVCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HyperVCollectorsClient) getHandleResponse(resp *http.Response) (HyperVCollectorsClientGetResponse, error) { + result := HyperVCollectorsClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.HyperVCollector); err != nil { + return HyperVCollectorsClientGetResponse{}, err + } + return result, nil +} + +// NewListByProjectPager - Get a list of Hyper-V collector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - HyperVCollectorsClientListByProjectOptions contains the optional parameters for the HyperVCollectorsClient.ListByProject +// method. +func (client *HyperVCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *HyperVCollectorsClientListByProjectOptions) *runtime.Pager[HyperVCollectorsClientListByProjectResponse] { + return runtime.NewPager(runtime.PagingHandler[HyperVCollectorsClientListByProjectResponse]{ + More: func(page HyperVCollectorsClientListByProjectResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *HyperVCollectorsClientListByProjectResponse) (HyperVCollectorsClientListByProjectResponse, error) { + req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return HyperVCollectorsClientListByProjectResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return HyperVCollectorsClientListByProjectResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return HyperVCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) + } + return client.listByProjectHandleResponse(resp) + }, + }) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *HyperVCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *HyperVCollectorsClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/hypervcollectors" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *HyperVCollectorsClient) listByProjectHandleResponse(resp *http.Response) (HyperVCollectorsClientListByProjectResponse, error) { + result := HyperVCollectorsClientListByProjectResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.HyperVCollectorList); err != nil { + return HyperVCollectorsClientListByProjectResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_importcollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_importcollectors_client.go new file mode 100644 index 000000000000..c4d04f98cbfc --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_importcollectors_client.go @@ -0,0 +1,314 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// ImportCollectorsClient contains the methods for the ImportCollectors group. +// Don't use this type directly, use NewImportCollectorsClient() instead. +type ImportCollectorsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewImportCollectorsClient creates a new instance of ImportCollectorsClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewImportCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ImportCollectorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ImportCollectorsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Create - Create or Update Import collector +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// importCollectorName - Unique name of a Import collector within a project. +// options - ImportCollectorsClientCreateOptions contains the optional parameters for the ImportCollectorsClient.Create method. +func (client *ImportCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientCreateOptions) (ImportCollectorsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, importCollectorName, options) + if err != nil { + return ImportCollectorsClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ImportCollectorsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ImportCollectorsClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *ImportCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if importCollectorName == "" { + return nil, errors.New("parameter importCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{importCollectorName}", url.PathEscape(importCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.CollectorBody != nil { + return req, runtime.MarshalAsJSON(req, *options.CollectorBody) + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *ImportCollectorsClient) createHandleResponse(resp *http.Response) (ImportCollectorsClientCreateResponse, error) { + result := ImportCollectorsClientCreateResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ImportCollector); err != nil { + return ImportCollectorsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Import collector from the project. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// importCollectorName - Unique name of a Import collector within a project. +// options - ImportCollectorsClientDeleteOptions contains the optional parameters for the ImportCollectorsClient.Delete method. +func (client *ImportCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientDeleteOptions) (ImportCollectorsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, importCollectorName, options) + if err != nil { + return ImportCollectorsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ImportCollectorsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ImportCollectorsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return client.deleteHandleResponse(resp) +} + +// deleteCreateRequest creates the Delete request. +func (client *ImportCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if importCollectorName == "" { + return nil, errors.New("parameter importCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{importCollectorName}", url.PathEscape(importCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *ImportCollectorsClient) deleteHandleResponse(resp *http.Response) (ImportCollectorsClientDeleteResponse, error) { + result := ImportCollectorsClientDeleteResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + return result, nil +} + +// Get - Get a Import collector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// importCollectorName - Unique name of a Import collector within a project. +// options - ImportCollectorsClientGetOptions contains the optional parameters for the ImportCollectorsClient.Get method. +func (client *ImportCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientGetOptions) (ImportCollectorsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, importCollectorName, options) + if err != nil { + return ImportCollectorsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ImportCollectorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImportCollectorsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ImportCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, importCollectorName string, options *ImportCollectorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors/{importCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if importCollectorName == "" { + return nil, errors.New("parameter importCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{importCollectorName}", url.PathEscape(importCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ImportCollectorsClient) getHandleResponse(resp *http.Response) (ImportCollectorsClientGetResponse, error) { + result := ImportCollectorsClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ImportCollector); err != nil { + return ImportCollectorsClientGetResponse{}, err + } + return result, nil +} + +// NewListByProjectPager - Get a list of Import collector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - ImportCollectorsClientListByProjectOptions contains the optional parameters for the ImportCollectorsClient.ListByProject +// method. +func (client *ImportCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *ImportCollectorsClientListByProjectOptions) *runtime.Pager[ImportCollectorsClientListByProjectResponse] { + return runtime.NewPager(runtime.PagingHandler[ImportCollectorsClientListByProjectResponse]{ + More: func(page ImportCollectorsClientListByProjectResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ImportCollectorsClientListByProjectResponse) (ImportCollectorsClientListByProjectResponse, error) { + req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return ImportCollectorsClientListByProjectResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ImportCollectorsClientListByProjectResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ImportCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) + } + return client.listByProjectHandleResponse(resp) + }, + }) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *ImportCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ImportCollectorsClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/importcollectors" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *ImportCollectorsClient) listByProjectHandleResponse(resp *http.Response) (ImportCollectorsClientListByProjectResponse, error) { + result := ImportCollectorsClientListByProjectResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ImportCollectorList); err != nil { + return ImportCollectorsClientListByProjectResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_machines_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_machines_client.go new file mode 100644 index 000000000000..5cfe28717886 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_machines_client.go @@ -0,0 +1,192 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// MachinesClient contains the methods for the Machines group. +// Don't use this type directly, use NewMachinesClient() instead. +type MachinesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewMachinesClient creates a new instance of MachinesClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MachinesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &MachinesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get the machine with the specified name. Returns a json object of type 'machine' defined in Models section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// machineName - Unique name of a machine in private datacenter. +// options - MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. +func (client *MachinesClient) Get(ctx context.Context, resourceGroupName string, projectName string, machineName string, options *MachinesClientGetOptions) (MachinesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, machineName, options) + if err != nil { + return MachinesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MachinesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MachinesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *MachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, machineName string, options *MachinesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines/{machineName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if machineName == "" { + return nil, errors.New("parameter machineName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{machineName}", url.PathEscape(machineName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MachinesClient) getHandleResponse(resp *http.Response) (MachinesClientGetResponse, error) { + result := MachinesClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Machine); err != nil { + return MachinesClientGetResponse{}, err + } + return result, nil +} + +// NewListByProjectPager - Get data of all the machines available in the project. Returns a json array of objects of type +// 'machine' defined in Models section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - MachinesClientListByProjectOptions contains the optional parameters for the MachinesClient.ListByProject method. +func (client *MachinesClient) NewListByProjectPager(resourceGroupName string, projectName string, options *MachinesClientListByProjectOptions) *runtime.Pager[MachinesClientListByProjectResponse] { + return runtime.NewPager(runtime.PagingHandler[MachinesClientListByProjectResponse]{ + More: func(page MachinesClientListByProjectResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MachinesClientListByProjectResponse) (MachinesClientListByProjectResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return MachinesClientListByProjectResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MachinesClientListByProjectResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MachinesClientListByProjectResponse{}, runtime.NewResponseError(resp) + } + return client.listByProjectHandleResponse(resp) + }, + }) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *MachinesClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *MachinesClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *MachinesClient) listByProjectHandleResponse(resp *http.Response) (MachinesClientListByProjectResponse, error) { + result := MachinesClientListByProjectResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.MachineResultList); err != nil { + return MachinesClientListByProjectResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_models.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_models.go new file mode 100644 index 000000000000..05cfec0f9f90 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_models.go @@ -0,0 +1,1189 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import "time" + +// AssessedDisk - A disk assessed for an assessment. +type AssessedDisk struct { + // READ-ONLY; User friendly name of the assessed disk. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; Gigabytes of storage provided by the recommended Azure disk size. + GigabytesForRecommendedDiskSize *int32 `json:"gigabytesForRecommendedDiskSize,omitempty" azure:"ro"` + + // READ-ONLY; Gigabytes of storage provisioned for this disk. + GigabytesProvisioned *float64 `json:"gigabytesProvisioned,omitempty" azure:"ro"` + + // READ-ONLY; Disk throughput in MegaBytes per second. + MegabytesPerSecondOfRead *float64 `json:"megabytesPerSecondOfRead,omitempty" azure:"ro"` + + // READ-ONLY; Disk throughput in MegaBytes per second. + MegabytesPerSecondOfWrite *float64 `json:"megabytesPerSecondOfWrite,omitempty" azure:"ro"` + + // READ-ONLY; Estimated aggregate storage cost for a 31-day month for this disk. + MonthlyStorageCost *float64 `json:"monthlyStorageCost,omitempty" azure:"ro"` + + // READ-ONLY; Name of the assessed disk. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Number of read operations per second for the disk. + NumberOfReadOperationsPerSecond *float64 `json:"numberOfReadOperationsPerSecond,omitempty" azure:"ro"` + + // READ-ONLY; Number of read and write operations per second for the disk. + NumberOfWriteOperationsPerSecond *float64 `json:"numberOfWriteOperationsPerSecond,omitempty" azure:"ro"` + + // READ-ONLY; Recommended Azure size for the disk, given utilization data and preferences set on Assessment. + RecommendedDiskSize *AzureDiskSize `json:"recommendedDiskSize,omitempty" azure:"ro"` + + // READ-ONLY; Storage type selected for this disk. + RecommendedDiskType *AzureDiskType `json:"recommendedDiskType,omitempty" azure:"ro"` + + // READ-ONLY; Whether this disk is suitable for Azure. + Suitability *CloudSuitability `json:"suitability,omitempty" azure:"ro"` + + // READ-ONLY; If disk is suitable to be migrate but some conditions/checks were not considered while calculating suitability, + // this explains the details. + SuitabilityDetail *AzureDiskSuitabilityDetail `json:"suitabilityDetail,omitempty" azure:"ro"` + + // READ-ONLY; If disk is not suitable to be migrated, this explains the reasons and mitigation steps. + SuitabilityExplanation *AzureDiskSuitabilityExplanation `json:"suitabilityExplanation,omitempty" azure:"ro"` +} + +// AssessedMachine - A machine evaluated as part of an assessment. +type AssessedMachine struct { + // For optimistic concurrency control. + ETag *string `json:"eTag,omitempty"` + + // Properties of an assessed machine. + Properties *AssessedMachineProperties `json:"properties,omitempty"` + + // READ-ONLY; Path reference to this assessed machine. + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessments/{assessmentName}/assessedMachines/{assessedMachineName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Name of the machine. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/groups/assessments/assessedMachines]. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AssessedMachineProperties - Properties of an assessed machine. +type AssessedMachineProperties struct { + // READ-ONLY; Boot type of the machine. + BootType *MachineBootType `json:"bootType,omitempty" azure:"ro"` + + // READ-ONLY; Confidence rating of assessed machine. + ConfidenceRatingInPercentage *float64 `json:"confidenceRatingInPercentage,omitempty" azure:"ro"` + + // READ-ONLY; Time when this machine was created. Date-Time represented in ISO-8601 format. + CreatedTimestamp *time.Time `json:"createdTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; ARM ID of the discovered machine. + DatacenterMachineArmID *string `json:"datacenterMachineArmId,omitempty" azure:"ro"` + + // READ-ONLY; ARM ID of the discovered datacenter. + DatacenterManagementServerArmID *string `json:"datacenterManagementServerArmId,omitempty" azure:"ro"` + + // READ-ONLY; Name of the server hosting the datacenter management solution. + DatacenterManagementServerName *string `json:"datacenterManagementServerName,omitempty" azure:"ro"` + + // READ-ONLY; Description of the machine + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; Dictionary of disks attached to the machine. Key is ID of disk. Value is a disk object. + Disks map[string]*AssessedDisk `json:"disks,omitempty" azure:"ro"` + + // READ-ONLY; User readable name of the machine as defined by the user in their private datacenter. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; Memory in Megabytes. + MegabytesOfMemory *float64 `json:"megabytesOfMemory,omitempty" azure:"ro"` + + // READ-ONLY; Megabytes of memory in the Recommended Azure VM Size. + MegabytesOfMemoryForRecommendedSize *float64 `json:"megabytesOfMemoryForRecommendedSize,omitempty" azure:"ro"` + + // READ-ONLY; Monthly network cost estimate for the network adapters that are attached to this machine as a group, for a 31-day + // month. + MonthlyBandwidthCost *float64 `json:"monthlyBandwidthCost,omitempty" azure:"ro"` + + // READ-ONLY; Compute Cost for a 31-day month, if the machine is migrated to Azure with the Recommended Size. + MonthlyComputeCostForRecommendedSize *float64 `json:"monthlyComputeCostForRecommendedSize,omitempty" azure:"ro"` + + // READ-ONLY; Monthly premium storage cost estimate for the disks that are attached to this machine as a group, for a 31-day + // month. + MonthlyPremiumStorageCost *float64 `json:"monthlyPremiumStorageCost,omitempty" azure:"ro"` + + // READ-ONLY; Monthly standard SSD storage cost estimate for the disks that are attached to this machine as a group, for a + // 31-day month. + MonthlyStandardSSDStorageCost *float64 `json:"monthlyStandardSSDStorageCost,omitempty" azure:"ro"` + + // READ-ONLY; Monthly storage cost estimate for the disks that are attached to this machine as a group, for a 31-day month. + MonthlyStorageCost *float64 `json:"monthlyStorageCost,omitempty" azure:"ro"` + + // READ-ONLY; Dictionary of network adapters attached to the machine. Key is name of the adapter. Value is a network adapter + // object. + NetworkAdapters map[string]*AssessedNetworkAdapter `json:"networkAdapters,omitempty" azure:"ro"` + + // READ-ONLY; Processor count. + NumberOfCores *int32 `json:"numberOfCores,omitempty" azure:"ro"` + + // READ-ONLY; Number of CPU cores in the Recommended Azure VM Size. + NumberOfCoresForRecommendedSize *int32 `json:"numberOfCoresForRecommendedSize,omitempty" azure:"ro"` + + // READ-ONLY; Operating System name of the machine. + OperatingSystemName *string `json:"operatingSystemName,omitempty" azure:"ro"` + + // READ-ONLY; Operating System type of the machine. + OperatingSystemType *string `json:"operatingSystemType,omitempty" azure:"ro"` + + // READ-ONLY; Operating System version of the machine. + OperatingSystemVersion *string `json:"operatingSystemVersion,omitempty" azure:"ro"` + + // READ-ONLY; Utilization percentage of the processor core as observed in the private data center, in the Time Range selected + // on Assessment, reported as the Percentile value based on the percentile number selected + // in assessment. + PercentageCoresUtilization *float64 `json:"percentageCoresUtilization,omitempty" azure:"ro"` + + // READ-ONLY; Utilization percentage of the memory as observed in the private data center, in the Time Range selected on Assessment, + // reported as the Percentile value based on the percentile number selected in + // assessment. + PercentageMemoryUtilization *float64 `json:"percentageMemoryUtilization,omitempty" azure:"ro"` + + // READ-ONLY; Recommended Azure size for this machine. + RecommendedSize *AzureVMSize `json:"recommendedSize,omitempty" azure:"ro"` + + // READ-ONLY; Whether machine is suitable for migration to Azure. + Suitability *CloudSuitability `json:"suitability,omitempty" azure:"ro"` + + // READ-ONLY; If machine is not suitable for cloud, this explains the reasons. + SuitabilityDetail *AzureVMSuitabilityDetail `json:"suitabilityDetail,omitempty" azure:"ro"` + + // READ-ONLY; If machine is not ready to be migrated, this explains the reasons and mitigation steps. + SuitabilityExplanation *AzureVMSuitabilityExplanation `json:"suitabilityExplanation,omitempty" azure:"ro"` + + // READ-ONLY; Time when this machine was last updated. Date-Time represented in ISO-8601 format. + UpdatedTimestamp *time.Time `json:"updatedTimestamp,omitempty" azure:"ro"` +} + +// AssessedMachineResultList - List of assessed machines. +type AssessedMachineResultList struct { + NextLink *string `json:"nextLink,omitempty"` + + // List of assessed machines. + Value []*AssessedMachine `json:"value,omitempty"` +} + +// AssessedMachinesClientGetOptions contains the optional parameters for the AssessedMachinesClient.Get method. +type AssessedMachinesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AssessedMachinesClientListByAssessmentOptions contains the optional parameters for the AssessedMachinesClient.ListByAssessment +// method. +type AssessedMachinesClientListByAssessmentOptions struct { + // placeholder for future optional parameters +} + +// AssessedNetworkAdapter - A network adapter assessed for an assessment. +type AssessedNetworkAdapter struct { + // Gigabytes transmitted through this adapter each month. + NetGigabytesTransmittedPerMonth *float64 `json:"netGigabytesTransmittedPerMonth,omitempty"` + + // READ-ONLY; User friendly name of the assessed network adapter. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; List of IP Addresses on the network adapter. + IPAddresses []*string `json:"ipAddresses,omitempty" azure:"ro"` + + // READ-ONLY; MAC Address of the network adapter. + MacAddress *string `json:"macAddress,omitempty" azure:"ro"` + + // READ-ONLY; Adapter throughput for incoming traffic in MegaBytes per second. + MegabytesPerSecondReceived *float64 `json:"megabytesPerSecondReceived,omitempty" azure:"ro"` + + // READ-ONLY; Adapter throughput for outgoing traffic in MegaBytes per second. + MegabytesPerSecondTransmitted *float64 `json:"megabytesPerSecondTransmitted,omitempty" azure:"ro"` + + // READ-ONLY; Monthly cost estimate for network bandwidth used by this network adapter. + MonthlyBandwidthCosts *float64 `json:"monthlyBandwidthCosts,omitempty" azure:"ro"` + + // READ-ONLY; Whether this adapter is suitable for Azure. + Suitability *CloudSuitability `json:"suitability,omitempty" azure:"ro"` + + // READ-ONLY; If network adapter is not suitable for cloud, this explains the reasons. + SuitabilityDetail *AzureNetworkAdapterSuitabilityDetail `json:"suitabilityDetail,omitempty" azure:"ro"` + + // READ-ONLY; If network adapter is suitable, this explains the reasons and mitigation steps. + SuitabilityExplanation *AzureNetworkAdapterSuitabilityExplanation `json:"suitabilityExplanation,omitempty" azure:"ro"` +} + +// Assessment - An assessment created for a group in the Migration project. +type Assessment struct { + // REQUIRED; Properties of the assessment. + Properties *AssessmentProperties `json:"properties,omitempty"` + + // For optimistic concurrency control. + ETag *string `json:"eTag,omitempty"` + + // READ-ONLY; Path reference to this assessment. + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName}/assessment/{assessmentName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Unique name of an assessment. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/groups/assessments]. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// AssessmentOptions - Assessment options. +type AssessmentOptions struct { + // REQUIRED; Properties of the assessment options. + Properties *AssessmentOptionsProperties `json:"properties,omitempty"` + + // READ-ONLY; Unique identifier of an assessment options. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Unique name of an assessment options. + Name *string `json:"name,omitempty" azure:"ro"` +} + +// AssessmentOptionsProperties - Assessment options properties. +type AssessmentOptionsProperties struct { + // READ-ONLY; List of supported currencies for reserved instances. + ReservedInstanceSupportedCurrencies []*string `json:"reservedInstanceSupportedCurrencies,omitempty" azure:"ro"` + + // READ-ONLY; List of supported Azure regions for reserved instances. + ReservedInstanceSupportedLocations []*string `json:"reservedInstanceSupportedLocations,omitempty" azure:"ro"` + + // READ-ONLY; List of supported Azure offer codes for reserved instances. + ReservedInstanceSupportedOffers []*string `json:"reservedInstanceSupportedOffers,omitempty" azure:"ro"` + + // READ-ONLY; List of supported VM Families. + ReservedInstanceVMFamilies []*string `json:"reservedInstanceVmFamilies,omitempty" azure:"ro"` + + // READ-ONLY; Dictionary of VM families grouped by vm family name describing the targeted azure locations of VM family and + // the category of the family. + VMFamilies []*VMFamily `json:"vmFamilies,omitempty" azure:"ro"` +} + +// AssessmentOptionsResultList - List of API operations. +type AssessmentOptionsResultList struct { + // List of operations. + Value []*AssessmentOptions `json:"value,omitempty"` +} + +// AssessmentProperties - Properties of an assessment. +type AssessmentProperties struct { + // REQUIRED; Storage type selected for this disk. + AzureDiskType *AzureDiskType `json:"azureDiskType,omitempty"` + + // REQUIRED; AHUB discount on windows virtual machines. + AzureHybridUseBenefit *AzureHybridUseBenefit `json:"azureHybridUseBenefit,omitempty"` + + // REQUIRED; Target Azure location for which the machines should be assessed. These enums are the same as used by Compute + // API. + AzureLocation *AzureLocation `json:"azureLocation,omitempty"` + + // REQUIRED; Offer code according to which cost estimation is done. + AzureOfferCode *AzureOfferCode `json:"azureOfferCode,omitempty"` + + // REQUIRED; Pricing tier for Size evaluation. + AzurePricingTier *AzurePricingTier `json:"azurePricingTier,omitempty"` + + // REQUIRED; Storage Redundancy type offered by Azure. + AzureStorageRedundancy *AzureStorageRedundancy `json:"azureStorageRedundancy,omitempty"` + + // REQUIRED; List of azure VM families. + AzureVMFamilies []*AzureVMFamily `json:"azureVmFamilies,omitempty"` + + // REQUIRED; Currency to report prices in. + Currency *Currency `json:"currency,omitempty"` + + // REQUIRED; Custom discount percentage to be applied on final costs. Can be in the range [0, 100]. + DiscountPercentage *float64 `json:"discountPercentage,omitempty"` + + // REQUIRED; Percentile of performance data used to recommend Azure size. + Percentile *Percentile `json:"percentile,omitempty"` + + // REQUIRED; Azure reserved instance. + ReservedInstance *ReservedInstance `json:"reservedInstance,omitempty"` + + // REQUIRED; Scaling factor used over utilization data to add a performance buffer for new machines to be created in Azure. + // Min Value = 1.0, Max value = 1.9, Default = 1.3. + ScalingFactor *float64 `json:"scalingFactor,omitempty"` + + // REQUIRED; Assessment sizing criterion. + SizingCriterion *AssessmentSizingCriterion `json:"sizingCriterion,omitempty"` + + // REQUIRED; User configurable setting that describes the status of the assessment. + Stage *AssessmentStage `json:"stage,omitempty"` + + // REQUIRED; Time range of performance data used to recommend a size. + TimeRange *TimeRange `json:"timeRange,omitempty"` + + // REQUIRED; Specify the duration for which the VMs are up in the on-premises environment. + VMUptime *VMUptime `json:"vmUptime,omitempty"` + + // READ-ONLY; Confidence rating percentage for assessment. Can be in the range [0, 100]. + ConfidenceRatingInPercentage *float64 `json:"confidenceRatingInPercentage,omitempty" azure:"ro"` + + // READ-ONLY; Time when this project was created. Date-Time represented in ISO-8601 format. + CreatedTimestamp *time.Time `json:"createdTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; Enterprise agreement subscription arm id. + EaSubscriptionID *string `json:"eaSubscriptionId,omitempty" azure:"ro"` + + // READ-ONLY; Monthly network cost estimate for the machines that are part of this assessment as a group, for a 31-day month. + MonthlyBandwidthCost *float64 `json:"monthlyBandwidthCost,omitempty" azure:"ro"` + + // READ-ONLY; Monthly compute cost estimate for the machines that are part of this assessment as a group, for a 31-day month. + MonthlyComputeCost *float64 `json:"monthlyComputeCost,omitempty" azure:"ro"` + + // READ-ONLY; Monthly premium storage cost estimate for the machines that are part of this assessment as a group, for a 31-day + // month. + MonthlyPremiumStorageCost *float64 `json:"monthlyPremiumStorageCost,omitempty" azure:"ro"` + + // READ-ONLY; Monthly standard SSD storage cost estimate for the machines that are part of this assessment as a group, for + // a 31-day month. + MonthlyStandardSSDStorageCost *float64 `json:"monthlyStandardSSDStorageCost,omitempty" azure:"ro"` + + // READ-ONLY; Monthly storage cost estimate for the machines that are part of this assessment as a group, for a 31-day month. + MonthlyStorageCost *float64 `json:"monthlyStorageCost,omitempty" azure:"ro"` + + // READ-ONLY; Number of assessed machines part of this assessment. + NumberOfMachines *int32 `json:"numberOfMachines,omitempty" azure:"ro"` + + // READ-ONLY; End time to consider performance data for assessment + PerfDataEndTime *time.Time `json:"perfDataEndTime,omitempty" azure:"ro"` + + // READ-ONLY; Start time to consider performance data for assessment + PerfDataStartTime *time.Time `json:"perfDataStartTime,omitempty" azure:"ro"` + + // READ-ONLY; Time when the Azure Prices were queried. Date-Time represented in ISO-8601 format. + PricesTimestamp *time.Time `json:"pricesTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; Whether the assessment has been created and is valid. + Status *AssessmentStatus `json:"status,omitempty" azure:"ro"` + + // READ-ONLY; Time when this project was last updated. Date-Time represented in ISO-8601 format. + UpdatedTimestamp *time.Time `json:"updatedTimestamp,omitempty" azure:"ro"` +} + +// AssessmentResultList - List of assessments. +type AssessmentResultList struct { + // List of assessments. + Value []*Assessment `json:"value,omitempty"` +} + +// AssessmentsClientCreateOptions contains the optional parameters for the AssessmentsClient.Create method. +type AssessmentsClientCreateOptions struct { + // New or Updated Assessment object. + Assessment *Assessment +} + +// AssessmentsClientDeleteOptions contains the optional parameters for the AssessmentsClient.Delete method. +type AssessmentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AssessmentsClientGetOptions contains the optional parameters for the AssessmentsClient.Get method. +type AssessmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AssessmentsClientGetReportDownloadURLOptions contains the optional parameters for the AssessmentsClient.GetReportDownloadURL +// method. +type AssessmentsClientGetReportDownloadURLOptions struct { + // placeholder for future optional parameters +} + +// AssessmentsClientListByGroupOptions contains the optional parameters for the AssessmentsClient.ListByGroup method. +type AssessmentsClientListByGroupOptions struct { + // placeholder for future optional parameters +} + +// AssessmentsClientListByProjectOptions contains the optional parameters for the AssessmentsClient.ListByProject method. +type AssessmentsClientListByProjectOptions struct { + // placeholder for future optional parameters +} + +// CloudError - An error response from the Azure Migrate service. +type CloudError struct { + // An error response from the Azure Migrate service. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody - An error response from the Azure Migrate 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"` +} + +type CollectorAgentProperties struct { + SpnDetails *CollectorBodyAgentSpnProperties `json:"spnDetails,omitempty"` + + // READ-ONLY + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY + LastHeartbeatUTC *time.Time `json:"lastHeartbeatUtc,omitempty" azure:"ro"` + + // READ-ONLY + Version *string `json:"version,omitempty" azure:"ro"` +} + +type CollectorBodyAgentSpnProperties struct { + // Application/client Id for the service principal with which the on-premise management/data plane components would communicate + // with our Azure services. + ApplicationID *string `json:"applicationId,omitempty"` + + // Intended audience for the service principal. + Audience *string `json:"audience,omitempty"` + + // AAD Authority URL which was used to request the token for the service principal. + Authority *string `json:"authority,omitempty"` + + // Object Id of the service principal with which the on-premise management/data plane components would communicate with our + // Azure services. + ObjectID *string `json:"objectId,omitempty"` + + // Tenant Id for the service principal with which the on-premise management/data plane components would communicate with our + // Azure services. + TenantID *string `json:"tenantId,omitempty"` +} + +type CollectorProperties struct { + AgentProperties *CollectorAgentProperties `json:"agentProperties,omitempty"` + + // The ARM id of the discovery service site. + DiscoverySiteID *string `json:"discoverySiteId,omitempty"` + + // READ-ONLY; Time when this collector was created. Date-Time represented in ISO-8601 format. + CreatedTimestamp *string `json:"createdTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; Time when this collector was updated. Date-Time represented in ISO-8601 format. + UpdatedTimestamp *string `json:"updatedTimestamp,omitempty" azure:"ro"` +} + +// Disk - A disk discovered on a machine. +type Disk struct { + // READ-ONLY; User friendly name of the disk. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; Gigabytes of storage provisioned for this disk. + GigabytesAllocated *float64 `json:"gigabytesAllocated,omitempty" azure:"ro"` +} + +// DownloadURL - Download URL for assessment report. +type DownloadURL struct { + // READ-ONLY; Hyperlink to download report. + AssessmentReportURL *string `json:"assessmentReportUrl,omitempty" azure:"ro"` + + // READ-ONLY; Expiry date of download url. + ExpirationTime *time.Time `json:"expirationTime,omitempty" azure:"ro"` +} + +// Group - A group created in a Migration project. +type Group struct { + // REQUIRED; Properties of the group. + Properties *GroupProperties `json:"properties,omitempty"` + + // For optimistic concurrency control. + ETag *string `json:"eTag,omitempty"` + + // READ-ONLY; Path reference to this group. /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/groups/{groupName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Name of the group. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/groups]. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GroupBodyProperties - Body properties of group update. +type GroupBodyProperties struct { + // List of machine names that are part of this group. + Machines []*string `json:"machines,omitempty"` + + // Whether to add or remove the machines. + OperationType *GroupUpdateOperation `json:"operationType,omitempty"` +} + +// GroupProperties - Properties of group resource. +type GroupProperties struct { + // The type of group. + GroupType *string `json:"groupType,omitempty"` + + // READ-ONLY; If the assessments are in running state. + AreAssessmentsRunning *bool `json:"areAssessmentsRunning,omitempty" azure:"ro"` + + // READ-ONLY; List of References to Assessments created on this group. + Assessments []*string `json:"assessments,omitempty" azure:"ro"` + + // READ-ONLY; Time when this group was created. Date-Time represented in ISO-8601 format. + CreatedTimestamp *time.Time `json:"createdTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; Whether the group has been created and is valid. + GroupStatus *GroupStatus `json:"groupStatus,omitempty" azure:"ro"` + + // READ-ONLY; Number of machines part of this group. + MachineCount *int32 `json:"machineCount,omitempty" azure:"ro"` + + // READ-ONLY; Time when this group was last updated. Date-Time represented in ISO-8601 format. + UpdatedTimestamp *time.Time `json:"updatedTimestamp,omitempty" azure:"ro"` +} + +// GroupResultList - List of groups. +type GroupResultList struct { + // List of groups. + Value []*Group `json:"value,omitempty"` +} + +// GroupsClientCreateOptions contains the optional parameters for the GroupsClient.Create method. +type GroupsClientCreateOptions struct { + // New or Updated Group object. + Group *Group +} + +// GroupsClientDeleteOptions contains the optional parameters for the GroupsClient.Delete method. +type GroupsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// GroupsClientGetOptions contains the optional parameters for the GroupsClient.Get method. +type GroupsClientGetOptions struct { + // placeholder for future optional parameters +} + +// GroupsClientListByProjectOptions contains the optional parameters for the GroupsClient.ListByProject method. +type GroupsClientListByProjectOptions struct { + // placeholder for future optional parameters +} + +// GroupsClientUpdateMachinesOptions contains the optional parameters for the GroupsClient.UpdateMachines method. +type GroupsClientUpdateMachinesOptions struct { + // Machines list to be added or removed from group. + GroupUpdateProperties *UpdateGroupBody +} + +type HyperVCollector struct { + ETag *string `json:"eTag,omitempty"` + Properties *CollectorProperties `json:"properties,omitempty"` + + // READ-ONLY + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY + Type *string `json:"type,omitempty" azure:"ro"` +} + +// HyperVCollectorList - List of Hyper-V collectors. +type HyperVCollectorList struct { + // List of Hyper-V collectors. + Value []*HyperVCollector `json:"value,omitempty"` +} + +// HyperVCollectorsClientCreateOptions contains the optional parameters for the HyperVCollectorsClient.Create method. +type HyperVCollectorsClientCreateOptions struct { + // New or Updated Hyper-V collector. + CollectorBody *HyperVCollector +} + +// HyperVCollectorsClientDeleteOptions contains the optional parameters for the HyperVCollectorsClient.Delete method. +type HyperVCollectorsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// HyperVCollectorsClientGetOptions contains the optional parameters for the HyperVCollectorsClient.Get method. +type HyperVCollectorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// HyperVCollectorsClientListByProjectOptions contains the optional parameters for the HyperVCollectorsClient.ListByProject +// method. +type HyperVCollectorsClientListByProjectOptions struct { + // placeholder for future optional parameters +} + +type ImportCollector struct { + ETag *string `json:"eTag,omitempty"` + Properties *ImportCollectorProperties `json:"properties,omitempty"` + + // READ-ONLY + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ImportCollectorList - List of Import collectors. +type ImportCollectorList struct { + // List of Import collectors. + Value []*ImportCollector `json:"value,omitempty"` +} + +type ImportCollectorProperties struct { + DiscoverySiteID *string `json:"discoverySiteId,omitempty"` + + // READ-ONLY + CreatedTimestamp *string `json:"createdTimestamp,omitempty" azure:"ro"` + + // READ-ONLY + UpdatedTimestamp *string `json:"updatedTimestamp,omitempty" azure:"ro"` +} + +// ImportCollectorsClientCreateOptions contains the optional parameters for the ImportCollectorsClient.Create method. +type ImportCollectorsClientCreateOptions struct { + // New or Updated Import collector. + CollectorBody *ImportCollector +} + +// ImportCollectorsClientDeleteOptions contains the optional parameters for the ImportCollectorsClient.Delete method. +type ImportCollectorsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ImportCollectorsClientGetOptions contains the optional parameters for the ImportCollectorsClient.Get method. +type ImportCollectorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ImportCollectorsClientListByProjectOptions contains the optional parameters for the ImportCollectorsClient.ListByProject +// method. +type ImportCollectorsClientListByProjectOptions struct { + // placeholder for future optional parameters +} + +// Machine - A machine in a migration project. +type Machine struct { + // For optimistic concurrency control. + ETag *string `json:"eTag,omitempty"` + + // Properties of the machine. + Properties *MachineProperties `json:"properties,omitempty"` + + // READ-ONLY; Path reference to this machine. /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/machines/{machineName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Name of the machine. It is a GUID which is unique identifier of machine in private data center. For user-readable + // name, we have a displayName property on this machine. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/machines]. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MachineProperties - Properties of a machine. +type MachineProperties struct { + // READ-ONLY; Boot type of the machine. + BootType *MachineBootType `json:"bootType,omitempty" azure:"ro"` + + // READ-ONLY; Time when this machine was created. Date-Time represented in ISO-8601 format. + CreatedTimestamp *time.Time `json:"createdTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; ARM ID of the data center as tracked by the Microsoft.OffAzure. + DatacenterManagementServerArmID *string `json:"datacenterManagementServerArmId,omitempty" azure:"ro"` + + // READ-ONLY; Name of the server hosting the datacenter management solution. + DatacenterManagementServerName *string `json:"datacenterManagementServerName,omitempty" azure:"ro"` + + // READ-ONLY; Description of the machine + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; ARM ID of the machine as tracked by the Microsoft.OffAzure. + DiscoveryMachineArmID *string `json:"discoveryMachineArmId,omitempty" azure:"ro"` + + // READ-ONLY; Dictionary of disks attached to the machine. Key is ID of disk. Value is a disk object + Disks map[string]*Disk `json:"disks,omitempty" azure:"ro"` + + // READ-ONLY; User readable name of the machine as defined by the user in their private datacenter. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; List of references to the groups that the machine is member of. + Groups []*string `json:"groups,omitempty" azure:"ro"` + + // READ-ONLY; Memory in Megabytes. + MegabytesOfMemory *float32 `json:"megabytesOfMemory,omitempty" azure:"ro"` + + // READ-ONLY; Dictionary of network adapters attached to the machine. Key is ID of network adapter. Value is a network adapter + // object + NetworkAdapters map[string]*NetworkAdapter `json:"networkAdapters,omitempty" azure:"ro"` + + // READ-ONLY; Processor count. + NumberOfCores *int32 `json:"numberOfCores,omitempty" azure:"ro"` + + // READ-ONLY; Operating System name of the machine. + OperatingSystemName *string `json:"operatingSystemName,omitempty" azure:"ro"` + + // READ-ONLY; Operating System type of the machine. + OperatingSystemType *string `json:"operatingSystemType,omitempty" azure:"ro"` + + // READ-ONLY; Operating System version of the machine. + OperatingSystemVersion *string `json:"operatingSystemVersion,omitempty" azure:"ro"` + + // READ-ONLY; Time when this machine was last updated. Date-Time represented in ISO-8601 format. + UpdatedTimestamp *time.Time `json:"updatedTimestamp,omitempty" azure:"ro"` +} + +// MachineResultList - List of machines. +type MachineResultList struct { + NextLink *string `json:"nextLink,omitempty"` + + // List of machines. + Value []*Machine `json:"value,omitempty"` +} + +// MachinesClientGetOptions contains the optional parameters for the MachinesClient.Get method. +type MachinesClientGetOptions struct { + // placeholder for future optional parameters +} + +// MachinesClientListByProjectOptions contains the optional parameters for the MachinesClient.ListByProject method. +type MachinesClientListByProjectOptions struct { + // placeholder for future optional parameters +} + +// NetworkAdapter - A network adapter discovered on a machine. +type NetworkAdapter struct { + // READ-ONLY; User friendly name of the network adapter. + DisplayName *string `json:"displayName,omitempty" azure:"ro"` + + // READ-ONLY; List of IP Addresses on the network adapter. + IPAddresses []*string `json:"ipAddresses,omitempty" azure:"ro"` + + // READ-ONLY; MAC Address of the network adapter. + MacAddress *string `json:"macAddress,omitempty" azure:"ro"` +} + +// Operation - A REST API operation supported by the provider. +type Operation struct { + // READ-ONLY; Displayable properties of the operation. + Display *OperationDisplay `json:"display,omitempty" azure:"ro"` + + // READ-ONLY; Name of the operation. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Origin of the operation. + Origin *string `json:"origin,omitempty" azure:"ro"` +} + +// OperationDisplay - Displayable properties of the operation. +type OperationDisplay struct { + // READ-ONLY; Description of the operation. + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; Operation Type. + Operation *string `json:"operation,omitempty" azure:"ro"` + + // READ-ONLY; Provider of the operation. + Provider *string `json:"provider,omitempty" azure:"ro"` + + // READ-ONLY; Resource operated on by the operation. + Resource *string `json:"resource,omitempty" azure:"ro"` +} + +// OperationResultList - List of API operations. +type OperationResultList struct { + // List of operations. + Value []*Operation `json:"value,omitempty"` +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnection - A private endpoint connection for a project. +type PrivateEndpointConnection struct { + // REQUIRED; Properties of the private endpoint endpoint connection. + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + + // For optimistic concurrency control. + ETag *string `json:"eTag,omitempty"` + + // READ-ONLY; Path reference to this private endpoint endpoint connection. + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Name of the private endpoint endpoint connection. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/privateEndpointConnections]. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.Delete +// method. +type PrivateEndpointConnectionClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionClientGetOptions contains the optional parameters for the PrivateEndpointConnectionClient.Get +// method. +type PrivateEndpointConnectionClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionClientListByProjectOptions contains the optional parameters for the PrivateEndpointConnectionClient.ListByProject +// method. +type PrivateEndpointConnectionClientListByProjectOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionClient.Update +// method. +type PrivateEndpointConnectionClientUpdateOptions struct { + // New or Updated Private Endpoint Connection object. + PrivateEndpointConnectionBody *PrivateEndpointConnection +} + +// PrivateEndpointConnectionCollection - A collection of private endpoint connections for a project. +type PrivateEndpointConnectionCollection struct { + // READ-ONLY + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; A list of private endpoint connections for a project. + Value []*PrivateEndpointConnection `json:"value,omitempty" azure:"ro"` +} + +// PrivateEndpointConnectionProperties - Private endpoint connection properties. +type PrivateEndpointConnectionProperties struct { + // State of the private endpoint connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + + // READ-ONLY; ARM id for the private endpoint resource corresponding to the connection. + PrivateEndpoint *ResourceID `json:"privateEndpoint,omitempty" azure:"ro"` + + // READ-ONLY; Indicates whether there is an ongoing operation on the private endpoint. + ProvisioningState *PrivateEndpointConnectionPropertiesProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// PrivateLinkResource - A private link resource for a project for which a private endpoint can be created. +type PrivateLinkResource struct { + // READ-ONLY; Path reference to this private link resource. + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/privateLinkResources/{privateLinkResourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Name of the private link resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Properties of the private link resource. + Properties *PrivateLinkResourceProperties `json:"properties,omitempty" azure:"ro"` + + // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects/privateLinkResources]. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// PrivateLinkResourceClientGetOptions contains the optional parameters for the PrivateLinkResourceClient.Get method. +type PrivateLinkResourceClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourceClientListByProjectOptions contains the optional parameters for the PrivateLinkResourceClient.ListByProject +// method. +type PrivateLinkResourceClientListByProjectOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourceCollection - A list of private link resources +type PrivateLinkResourceCollection struct { + // READ-ONLY; Link to retrieve next page of results. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; Array of results. + Value []*PrivateLinkResource `json:"value,omitempty" azure:"ro"` +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // READ-ONLY; The private link resource group id. + GroupID *string `json:"groupId,omitempty" azure:"ro"` + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string `json:"requiredMembers,omitempty" azure:"ro"` + + // READ-ONLY; Required DNS zone names of the the private link resource. + RequiredZoneNames []*string `json:"requiredZoneNames,omitempty" azure:"ro"` +} + +// PrivateLinkServiceConnectionState - State of a private endpoint connection. +type PrivateLinkServiceConnectionState struct { + // Actions required on the private endpoint connection. + ActionsRequired *string `json:"actionsRequired,omitempty"` + + // Description of the private endpoint connection. + Description *string `json:"description,omitempty"` + + // Connection status of the private endpoint connection. + Status *PrivateLinkServiceConnectionStateStatus `json:"status,omitempty"` +} + +// Project - Azure Migrate Project. +type Project struct { + // For optimistic concurrency control. + ETag *string `json:"eTag,omitempty"` + + // Azure location in which project is created. + Location *string `json:"location,omitempty"` + + // Properties of the project. + Properties *ProjectProperties `json:"properties,omitempty"` + + // Tags provided by Azure Tagging service. + Tags interface{} `json:"tags,omitempty"` + + // READ-ONLY; Path reference to this project /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Name of the project. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Type of the object = [Microsoft.Migrate/assessmentProjects]. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ProjectProperties - Properties of a project. +type ProjectProperties struct { + // Assessment solution ARM id tracked by Microsoft.Migrate/migrateProjects. + AssessmentSolutionID *string `json:"assessmentSolutionId,omitempty"` + + // The ARM id of the storage account used for interactions when public access is disabled. + CustomerStorageAccountArmID *string `json:"customerStorageAccountArmId,omitempty"` + + // The ARM id of service map workspace created by customer. + CustomerWorkspaceID *string `json:"customerWorkspaceId,omitempty"` + + // Location of service map workspace created by customer. + CustomerWorkspaceLocation *string `json:"customerWorkspaceLocation,omitempty"` + + // Assessment project status. + ProjectStatus *ProjectStatus `json:"projectStatus,omitempty"` + + // This value can be set to 'enabled' to avoid breaking changes on existing customer resources and templates. If set to 'disabled', + // traffic over public interface is not allowed, and private endpoint + // connections would be the exclusive access method. + PublicNetworkAccess *string `json:"publicNetworkAccess,omitempty"` + + // READ-ONLY; Time when this project was created. Date-Time represented in ISO-8601 format. + CreatedTimestamp *time.Time `json:"createdTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; Time when last assessment was created. Date-Time represented in ISO-8601 format. This value will be null until + // assessment is created. + LastAssessmentTimestamp *time.Time `json:"lastAssessmentTimestamp,omitempty" azure:"ro"` + + // READ-ONLY; Number of assessments created in the project. + NumberOfAssessments *int32 `json:"numberOfAssessments,omitempty" azure:"ro"` + + // READ-ONLY; Number of groups created in the project. + NumberOfGroups *int32 `json:"numberOfGroups,omitempty" azure:"ro"` + + // READ-ONLY; Number of machines in the project. + NumberOfMachines *int32 `json:"numberOfMachines,omitempty" azure:"ro"` + + // READ-ONLY; The list of private endpoint connections to the project. + PrivateEndpointConnections []*PrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` + + // READ-ONLY; Provisioning state of the project. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + + // READ-ONLY; Endpoint at which the collector agent can call agent REST API. + ServiceEndpoint *string `json:"serviceEndpoint,omitempty" azure:"ro"` + + // READ-ONLY; Time when this project was last updated. Date-Time represented in ISO-8601 format. + UpdatedTimestamp *time.Time `json:"updatedTimestamp,omitempty" azure:"ro"` +} + +// ProjectResultList - List of projects. +type ProjectResultList struct { + NextLink *string `json:"nextLink,omitempty"` + + // List of projects. + Value []*Project `json:"value,omitempty"` +} + +// ProjectsClientAssessmentOptionsListOptions contains the optional parameters for the ProjectsClient.AssessmentOptionsList +// method. +type ProjectsClientAssessmentOptionsListOptions struct { + // placeholder for future optional parameters +} + +// ProjectsClientAssessmentOptionsOptions contains the optional parameters for the ProjectsClient.AssessmentOptions method. +type ProjectsClientAssessmentOptionsOptions struct { + // placeholder for future optional parameters +} + +// ProjectsClientCreateOptions contains the optional parameters for the ProjectsClient.Create method. +type ProjectsClientCreateOptions struct { + // New or Updated project object. + Project *Project +} + +// ProjectsClientDeleteOptions contains the optional parameters for the ProjectsClient.Delete method. +type ProjectsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ProjectsClientGetOptions contains the optional parameters for the ProjectsClient.Get method. +type ProjectsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.ListBySubscription method. +type ProjectsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ProjectsClientListOptions contains the optional parameters for the ProjectsClient.List method. +type ProjectsClientListOptions struct { + // placeholder for future optional parameters +} + +// ProjectsClientUpdateOptions contains the optional parameters for the ProjectsClient.Update method. +type ProjectsClientUpdateOptions struct { + // Updated project object. + Project *Project +} + +// ResourceID - ARM id for a resource. +type ResourceID struct { + // READ-ONLY + ID *string `json:"id,omitempty" azure:"ro"` +} + +type ServerCollector struct { + ETag *string `json:"eTag,omitempty"` + Properties *CollectorProperties `json:"properties,omitempty"` + + // READ-ONLY + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ServerCollectorList - List of Server collectors. +type ServerCollectorList struct { + // List of Server collectors. + Value []*ServerCollector `json:"value,omitempty"` +} + +// ServerCollectorsClientCreateOptions contains the optional parameters for the ServerCollectorsClient.Create method. +type ServerCollectorsClientCreateOptions struct { + // New or Updated Server collector. + CollectorBody *ServerCollector +} + +// ServerCollectorsClientDeleteOptions contains the optional parameters for the ServerCollectorsClient.Delete method. +type ServerCollectorsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ServerCollectorsClientGetOptions contains the optional parameters for the ServerCollectorsClient.Get method. +type ServerCollectorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ServerCollectorsClientListByProjectOptions contains the optional parameters for the ServerCollectorsClient.ListByProject +// method. +type ServerCollectorsClientListByProjectOptions struct { + // placeholder for future optional parameters +} + +// UpdateGroupBody - Properties of group update. +type UpdateGroupBody struct { + // For optimistic concurrency control. + ETag *string `json:"eTag,omitempty"` + + // Properties of the group. + Properties *GroupBodyProperties `json:"properties,omitempty"` +} + +// VMFamily - VM family name, the list of targeted azure locations and the category of the family. +type VMFamily struct { + // READ-ONLY; Category of the VM family. + Category []*string `json:"category,omitempty" azure:"ro"` + + // READ-ONLY; Name of the VM family. + FamilyName *string `json:"familyName,omitempty" azure:"ro"` + + // READ-ONLY; List of Azure regions. + TargetLocations []*string `json:"targetLocations,omitempty" azure:"ro"` +} + +type VMUptime struct { + // Number of days in a month for VM uptime. + DaysPerMonth *int32 `json:"daysPerMonth,omitempty"` + + // Number of hours per day for VM uptime. + HoursPerDay *int32 `json:"hoursPerDay,omitempty"` +} + +type VMwareCollector struct { + ETag *string `json:"eTag,omitempty"` + Properties *CollectorProperties `json:"properties,omitempty"` + + // READ-ONLY + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY + Type *string `json:"type,omitempty" azure:"ro"` +} + +// VMwareCollectorList - List of VMware collectors. +type VMwareCollectorList struct { + // List of VMware collectors. + Value []*VMwareCollector `json:"value,omitempty"` +} + +// VMwareCollectorsClientCreateOptions contains the optional parameters for the VMwareCollectorsClient.Create method. +type VMwareCollectorsClientCreateOptions struct { + // New or Updated VMware collector. + CollectorBody *VMwareCollector +} + +// VMwareCollectorsClientDeleteOptions contains the optional parameters for the VMwareCollectorsClient.Delete method. +type VMwareCollectorsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// VMwareCollectorsClientGetOptions contains the optional parameters for the VMwareCollectorsClient.Get method. +type VMwareCollectorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// VMwareCollectorsClientListByProjectOptions contains the optional parameters for the VMwareCollectorsClient.ListByProject +// method. +type VMwareCollectorsClientListByProjectOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_models_serde.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_models_serde.go new file mode 100644 index 000000000000..305914f99872 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_models_serde.go @@ -0,0 +1,565 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessedMachineProperties. +func (a *AssessedMachineProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bootType": + err = unpopulate(val, "BootType", &a.BootType) + delete(rawMsg, key) + case "confidenceRatingInPercentage": + err = unpopulate(val, "ConfidenceRatingInPercentage", &a.ConfidenceRatingInPercentage) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulateTimeRFC3339(val, "CreatedTimestamp", &a.CreatedTimestamp) + delete(rawMsg, key) + case "datacenterMachineArmId": + err = unpopulate(val, "DatacenterMachineArmID", &a.DatacenterMachineArmID) + delete(rawMsg, key) + case "datacenterManagementServerArmId": + err = unpopulate(val, "DatacenterManagementServerArmID", &a.DatacenterManagementServerArmID) + delete(rawMsg, key) + case "datacenterManagementServerName": + err = unpopulate(val, "DatacenterManagementServerName", &a.DatacenterManagementServerName) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "disks": + err = unpopulate(val, "Disks", &a.Disks) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "megabytesOfMemory": + err = unpopulate(val, "MegabytesOfMemory", &a.MegabytesOfMemory) + delete(rawMsg, key) + case "megabytesOfMemoryForRecommendedSize": + err = unpopulate(val, "MegabytesOfMemoryForRecommendedSize", &a.MegabytesOfMemoryForRecommendedSize) + delete(rawMsg, key) + case "monthlyBandwidthCost": + err = unpopulate(val, "MonthlyBandwidthCost", &a.MonthlyBandwidthCost) + delete(rawMsg, key) + case "monthlyComputeCostForRecommendedSize": + err = unpopulate(val, "MonthlyComputeCostForRecommendedSize", &a.MonthlyComputeCostForRecommendedSize) + delete(rawMsg, key) + case "monthlyPremiumStorageCost": + err = unpopulate(val, "MonthlyPremiumStorageCost", &a.MonthlyPremiumStorageCost) + delete(rawMsg, key) + case "monthlyStandardSSDStorageCost": + err = unpopulate(val, "MonthlyStandardSSDStorageCost", &a.MonthlyStandardSSDStorageCost) + delete(rawMsg, key) + case "monthlyStorageCost": + err = unpopulate(val, "MonthlyStorageCost", &a.MonthlyStorageCost) + delete(rawMsg, key) + case "networkAdapters": + err = unpopulate(val, "NetworkAdapters", &a.NetworkAdapters) + delete(rawMsg, key) + case "numberOfCores": + err = unpopulate(val, "NumberOfCores", &a.NumberOfCores) + delete(rawMsg, key) + case "numberOfCoresForRecommendedSize": + err = unpopulate(val, "NumberOfCoresForRecommendedSize", &a.NumberOfCoresForRecommendedSize) + delete(rawMsg, key) + case "operatingSystemName": + err = unpopulate(val, "OperatingSystemName", &a.OperatingSystemName) + delete(rawMsg, key) + case "operatingSystemType": + err = unpopulate(val, "OperatingSystemType", &a.OperatingSystemType) + delete(rawMsg, key) + case "operatingSystemVersion": + err = unpopulate(val, "OperatingSystemVersion", &a.OperatingSystemVersion) + delete(rawMsg, key) + case "percentageCoresUtilization": + err = unpopulate(val, "PercentageCoresUtilization", &a.PercentageCoresUtilization) + delete(rawMsg, key) + case "percentageMemoryUtilization": + err = unpopulate(val, "PercentageMemoryUtilization", &a.PercentageMemoryUtilization) + delete(rawMsg, key) + case "recommendedSize": + err = unpopulate(val, "RecommendedSize", &a.RecommendedSize) + delete(rawMsg, key) + case "suitability": + err = unpopulate(val, "Suitability", &a.Suitability) + delete(rawMsg, key) + case "suitabilityDetail": + err = unpopulate(val, "SuitabilityDetail", &a.SuitabilityDetail) + delete(rawMsg, key) + case "suitabilityExplanation": + err = unpopulate(val, "SuitabilityExplanation", &a.SuitabilityExplanation) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulateTimeRFC3339(val, "UpdatedTimestamp", &a.UpdatedTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssessmentProperties. +func (a AssessmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureDiskType", a.AzureDiskType) + populate(objectMap, "azureHybridUseBenefit", a.AzureHybridUseBenefit) + populate(objectMap, "azureLocation", a.AzureLocation) + populate(objectMap, "azureOfferCode", a.AzureOfferCode) + populate(objectMap, "azurePricingTier", a.AzurePricingTier) + populate(objectMap, "azureStorageRedundancy", a.AzureStorageRedundancy) + populate(objectMap, "azureVmFamilies", a.AzureVMFamilies) + populate(objectMap, "confidenceRatingInPercentage", a.ConfidenceRatingInPercentage) + populateTimeRFC3339(objectMap, "createdTimestamp", a.CreatedTimestamp) + populate(objectMap, "currency", a.Currency) + populate(objectMap, "discountPercentage", a.DiscountPercentage) + populate(objectMap, "eaSubscriptionId", a.EaSubscriptionID) + populate(objectMap, "monthlyBandwidthCost", a.MonthlyBandwidthCost) + populate(objectMap, "monthlyComputeCost", a.MonthlyComputeCost) + populate(objectMap, "monthlyPremiumStorageCost", a.MonthlyPremiumStorageCost) + populate(objectMap, "monthlyStandardSSDStorageCost", a.MonthlyStandardSSDStorageCost) + populate(objectMap, "monthlyStorageCost", a.MonthlyStorageCost) + populate(objectMap, "numberOfMachines", a.NumberOfMachines) + populate(objectMap, "percentile", a.Percentile) + populateTimeRFC3339(objectMap, "perfDataEndTime", a.PerfDataEndTime) + populateTimeRFC3339(objectMap, "perfDataStartTime", a.PerfDataStartTime) + populateTimeRFC3339(objectMap, "pricesTimestamp", a.PricesTimestamp) + populate(objectMap, "reservedInstance", a.ReservedInstance) + populate(objectMap, "scalingFactor", a.ScalingFactor) + populate(objectMap, "sizingCriterion", a.SizingCriterion) + populate(objectMap, "stage", a.Stage) + populate(objectMap, "status", a.Status) + populate(objectMap, "timeRange", a.TimeRange) + populateTimeRFC3339(objectMap, "updatedTimestamp", a.UpdatedTimestamp) + populate(objectMap, "vmUptime", a.VMUptime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentProperties. +func (a *AssessmentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "azureDiskType": + err = unpopulate(val, "AzureDiskType", &a.AzureDiskType) + delete(rawMsg, key) + case "azureHybridUseBenefit": + err = unpopulate(val, "AzureHybridUseBenefit", &a.AzureHybridUseBenefit) + delete(rawMsg, key) + case "azureLocation": + err = unpopulate(val, "AzureLocation", &a.AzureLocation) + delete(rawMsg, key) + case "azureOfferCode": + err = unpopulate(val, "AzureOfferCode", &a.AzureOfferCode) + delete(rawMsg, key) + case "azurePricingTier": + err = unpopulate(val, "AzurePricingTier", &a.AzurePricingTier) + delete(rawMsg, key) + case "azureStorageRedundancy": + err = unpopulate(val, "AzureStorageRedundancy", &a.AzureStorageRedundancy) + delete(rawMsg, key) + case "azureVmFamilies": + err = unpopulate(val, "AzureVMFamilies", &a.AzureVMFamilies) + delete(rawMsg, key) + case "confidenceRatingInPercentage": + err = unpopulate(val, "ConfidenceRatingInPercentage", &a.ConfidenceRatingInPercentage) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulateTimeRFC3339(val, "CreatedTimestamp", &a.CreatedTimestamp) + delete(rawMsg, key) + case "currency": + err = unpopulate(val, "Currency", &a.Currency) + delete(rawMsg, key) + case "discountPercentage": + err = unpopulate(val, "DiscountPercentage", &a.DiscountPercentage) + delete(rawMsg, key) + case "eaSubscriptionId": + err = unpopulate(val, "EaSubscriptionID", &a.EaSubscriptionID) + delete(rawMsg, key) + case "monthlyBandwidthCost": + err = unpopulate(val, "MonthlyBandwidthCost", &a.MonthlyBandwidthCost) + delete(rawMsg, key) + case "monthlyComputeCost": + err = unpopulate(val, "MonthlyComputeCost", &a.MonthlyComputeCost) + delete(rawMsg, key) + case "monthlyPremiumStorageCost": + err = unpopulate(val, "MonthlyPremiumStorageCost", &a.MonthlyPremiumStorageCost) + delete(rawMsg, key) + case "monthlyStandardSSDStorageCost": + err = unpopulate(val, "MonthlyStandardSSDStorageCost", &a.MonthlyStandardSSDStorageCost) + delete(rawMsg, key) + case "monthlyStorageCost": + err = unpopulate(val, "MonthlyStorageCost", &a.MonthlyStorageCost) + delete(rawMsg, key) + case "numberOfMachines": + err = unpopulate(val, "NumberOfMachines", &a.NumberOfMachines) + delete(rawMsg, key) + case "percentile": + err = unpopulate(val, "Percentile", &a.Percentile) + delete(rawMsg, key) + case "perfDataEndTime": + err = unpopulateTimeRFC3339(val, "PerfDataEndTime", &a.PerfDataEndTime) + delete(rawMsg, key) + case "perfDataStartTime": + err = unpopulateTimeRFC3339(val, "PerfDataStartTime", &a.PerfDataStartTime) + delete(rawMsg, key) + case "pricesTimestamp": + err = unpopulateTimeRFC3339(val, "PricesTimestamp", &a.PricesTimestamp) + delete(rawMsg, key) + case "reservedInstance": + err = unpopulate(val, "ReservedInstance", &a.ReservedInstance) + delete(rawMsg, key) + case "scalingFactor": + err = unpopulate(val, "ScalingFactor", &a.ScalingFactor) + delete(rawMsg, key) + case "sizingCriterion": + err = unpopulate(val, "SizingCriterion", &a.SizingCriterion) + delete(rawMsg, key) + case "stage": + err = unpopulate(val, "Stage", &a.Stage) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "timeRange": + err = unpopulate(val, "TimeRange", &a.TimeRange) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulateTimeRFC3339(val, "UpdatedTimestamp", &a.UpdatedTimestamp) + delete(rawMsg, key) + case "vmUptime": + err = unpopulate(val, "VMUptime", &a.VMUptime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CollectorAgentProperties. +func (c CollectorAgentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populateTimeRFC3339(objectMap, "lastHeartbeatUtc", c.LastHeartbeatUTC) + populate(objectMap, "spnDetails", c.SpnDetails) + populate(objectMap, "version", c.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CollectorAgentProperties. +func (c *CollectorAgentProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "lastHeartbeatUtc": + err = unpopulateTimeRFC3339(val, "LastHeartbeatUTC", &c.LastHeartbeatUTC) + delete(rawMsg, key) + case "spnDetails": + err = unpopulate(val, "SpnDetails", &c.SpnDetails) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &c.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DownloadURL. +func (d *DownloadURL) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentReportUrl": + err = unpopulate(val, "AssessmentReportURL", &d.AssessmentReportURL) + delete(rawMsg, key) + case "expirationTime": + err = unpopulateTimeRFC3339(val, "ExpirationTime", &d.ExpirationTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GroupBodyProperties. +func (g GroupBodyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "machines", g.Machines) + populate(objectMap, "operationType", g.OperationType) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type GroupProperties. +func (g GroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "areAssessmentsRunning", g.AreAssessmentsRunning) + populate(objectMap, "assessments", g.Assessments) + populateTimeRFC3339(objectMap, "createdTimestamp", g.CreatedTimestamp) + populate(objectMap, "groupStatus", g.GroupStatus) + populate(objectMap, "groupType", g.GroupType) + populate(objectMap, "machineCount", g.MachineCount) + populateTimeRFC3339(objectMap, "updatedTimestamp", g.UpdatedTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupProperties. +func (g *GroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "areAssessmentsRunning": + err = unpopulate(val, "AreAssessmentsRunning", &g.AreAssessmentsRunning) + delete(rawMsg, key) + case "assessments": + err = unpopulate(val, "Assessments", &g.Assessments) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulateTimeRFC3339(val, "CreatedTimestamp", &g.CreatedTimestamp) + delete(rawMsg, key) + case "groupStatus": + err = unpopulate(val, "GroupStatus", &g.GroupStatus) + delete(rawMsg, key) + case "groupType": + err = unpopulate(val, "GroupType", &g.GroupType) + delete(rawMsg, key) + case "machineCount": + err = unpopulate(val, "MachineCount", &g.MachineCount) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulateTimeRFC3339(val, "UpdatedTimestamp", &g.UpdatedTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MachineProperties. +func (m *MachineProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "bootType": + err = unpopulate(val, "BootType", &m.BootType) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulateTimeRFC3339(val, "CreatedTimestamp", &m.CreatedTimestamp) + delete(rawMsg, key) + case "datacenterManagementServerArmId": + err = unpopulate(val, "DatacenterManagementServerArmID", &m.DatacenterManagementServerArmID) + delete(rawMsg, key) + case "datacenterManagementServerName": + err = unpopulate(val, "DatacenterManagementServerName", &m.DatacenterManagementServerName) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "discoveryMachineArmId": + err = unpopulate(val, "DiscoveryMachineArmID", &m.DiscoveryMachineArmID) + delete(rawMsg, key) + case "disks": + err = unpopulate(val, "Disks", &m.Disks) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "groups": + err = unpopulate(val, "Groups", &m.Groups) + delete(rawMsg, key) + case "megabytesOfMemory": + err = unpopulate(val, "MegabytesOfMemory", &m.MegabytesOfMemory) + delete(rawMsg, key) + case "networkAdapters": + err = unpopulate(val, "NetworkAdapters", &m.NetworkAdapters) + delete(rawMsg, key) + case "numberOfCores": + err = unpopulate(val, "NumberOfCores", &m.NumberOfCores) + delete(rawMsg, key) + case "operatingSystemName": + err = unpopulate(val, "OperatingSystemName", &m.OperatingSystemName) + delete(rawMsg, key) + case "operatingSystemType": + err = unpopulate(val, "OperatingSystemType", &m.OperatingSystemType) + delete(rawMsg, key) + case "operatingSystemVersion": + err = unpopulate(val, "OperatingSystemVersion", &m.OperatingSystemVersion) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulateTimeRFC3339(val, "UpdatedTimestamp", &m.UpdatedTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Project. +func (p Project) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eTag", p.ETag) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "tags", &p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// MarshalJSON implements the json.Marshaller interface for type ProjectProperties. +func (p ProjectProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentSolutionId", p.AssessmentSolutionID) + populateTimeRFC3339(objectMap, "createdTimestamp", p.CreatedTimestamp) + populate(objectMap, "customerStorageAccountArmId", p.CustomerStorageAccountArmID) + populate(objectMap, "customerWorkspaceId", p.CustomerWorkspaceID) + populate(objectMap, "customerWorkspaceLocation", p.CustomerWorkspaceLocation) + populateTimeRFC3339(objectMap, "lastAssessmentTimestamp", p.LastAssessmentTimestamp) + populate(objectMap, "numberOfAssessments", p.NumberOfAssessments) + populate(objectMap, "numberOfGroups", p.NumberOfGroups) + populate(objectMap, "numberOfMachines", p.NumberOfMachines) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "projectStatus", p.ProjectStatus) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) + populate(objectMap, "serviceEndpoint", p.ServiceEndpoint) + populateTimeRFC3339(objectMap, "updatedTimestamp", p.UpdatedTimestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProjectProperties. +func (p *ProjectProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentSolutionId": + err = unpopulate(val, "AssessmentSolutionID", &p.AssessmentSolutionID) + delete(rawMsg, key) + case "createdTimestamp": + err = unpopulateTimeRFC3339(val, "CreatedTimestamp", &p.CreatedTimestamp) + delete(rawMsg, key) + case "customerStorageAccountArmId": + err = unpopulate(val, "CustomerStorageAccountArmID", &p.CustomerStorageAccountArmID) + delete(rawMsg, key) + case "customerWorkspaceId": + err = unpopulate(val, "CustomerWorkspaceID", &p.CustomerWorkspaceID) + delete(rawMsg, key) + case "customerWorkspaceLocation": + err = unpopulate(val, "CustomerWorkspaceLocation", &p.CustomerWorkspaceLocation) + delete(rawMsg, key) + case "lastAssessmentTimestamp": + err = unpopulateTimeRFC3339(val, "LastAssessmentTimestamp", &p.LastAssessmentTimestamp) + delete(rawMsg, key) + case "numberOfAssessments": + err = unpopulate(val, "NumberOfAssessments", &p.NumberOfAssessments) + delete(rawMsg, key) + case "numberOfGroups": + err = unpopulate(val, "NumberOfGroups", &p.NumberOfGroups) + delete(rawMsg, key) + case "numberOfMachines": + err = unpopulate(val, "NumberOfMachines", &p.NumberOfMachines) + delete(rawMsg, key) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) + delete(rawMsg, key) + case "projectStatus": + err = unpopulate(val, "ProjectStatus", &p.ProjectStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) + delete(rawMsg, key) + case "serviceEndpoint": + err = unpopulate(val, "ServiceEndpoint", &p.ServiceEndpoint) + delete(rawMsg, key) + case "updatedTimestamp": + err = unpopulateTimeRFC3339(val, "UpdatedTimestamp", &p.UpdatedTimestamp) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, 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, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_operations_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_operations_client.go new file mode 100644 index 000000000000..ba699d475c79 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_operations_client.go @@ -0,0 +1,95 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "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/cloud" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + host string + pl runtime.Pipeline +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Get a list of REST API supported by Microsoft.Migrate provider. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return OperationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return OperationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Migrate/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationResultList); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_privateendpointconnection_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_privateendpointconnection_client.go new file mode 100644 index 000000000000..48ce4467d735 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_privateendpointconnection_client.go @@ -0,0 +1,312 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// PrivateEndpointConnectionClient contains the methods for the PrivateEndpointConnection group. +// Don't use this type directly, use NewPrivateEndpointConnectionClient() instead. +type PrivateEndpointConnectionClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPrivateEndpointConnectionClient creates a new instance of PrivateEndpointConnectionClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPrivateEndpointConnectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Delete - Delete the private endpoint connection from the project. T. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// privateEndpointConnectionName - Unique name of a private endpoint connection within a project. +// options - PrivateEndpointConnectionClientDeleteOptions contains the optional parameters for the PrivateEndpointConnectionClient.Delete +// method. +func (client *PrivateEndpointConnectionClient) Delete(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientDeleteOptions) (PrivateEndpointConnectionClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return PrivateEndpointConnectionClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return client.deleteHandleResponse(resp) +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *PrivateEndpointConnectionClient) deleteHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientDeleteResponse, error) { + result := PrivateEndpointConnectionClientDeleteResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + return result, nil +} + +// Get - Get information related to a specific private endpoint connection in the project. Returns a json object of type 'privateEndpointConnections' +// as specified in the models section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// privateEndpointConnectionName - Unique name of a private endpoint connection within a project. +// options - PrivateEndpointConnectionClientGetOptions contains the optional parameters for the PrivateEndpointConnectionClient.Get +// method. +func (client *PrivateEndpointConnectionClient) Get(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientGetOptions) (PrivateEndpointConnectionClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientGetResponse, error) { + result := PrivateEndpointConnectionClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionClientGetResponse{}, err + } + return result, nil +} + +// ListByProject - Get all private endpoint connections in the project. Returns a json array of objects of type 'privateEndpointConnections' +// as specified in the Models section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - PrivateEndpointConnectionClientListByProjectOptions contains the optional parameters for the PrivateEndpointConnectionClient.ListByProject +// method. +func (client *PrivateEndpointConnectionClient) ListByProject(ctx context.Context, resourceGroupName string, projectName string, options *PrivateEndpointConnectionClientListByProjectOptions) (PrivateEndpointConnectionClientListByProjectResponse, error) { + req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return PrivateEndpointConnectionClientListByProjectResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionClientListByProjectResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateEndpointConnectionClientListByProjectResponse{}, runtime.NewResponseError(resp) + } + return client.listByProjectHandleResponse(resp) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *PrivateEndpointConnectionClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *PrivateEndpointConnectionClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *PrivateEndpointConnectionClient) listByProjectHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientListByProjectResponse, error) { + result := PrivateEndpointConnectionClientListByProjectResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionCollection); err != nil { + return PrivateEndpointConnectionClientListByProjectResponse{}, err + } + return result, nil +} + +// Update - Update a specific private endpoint connection in the project. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// privateEndpointConnectionName - Unique name of a private endpoint connection within a project. +// options - PrivateEndpointConnectionClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionClient.Update +// method. +func (client *PrivateEndpointConnectionClient) Update(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientUpdateOptions) (PrivateEndpointConnectionClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, projectName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateEndpointConnectionClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return PrivateEndpointConnectionClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *PrivateEndpointConnectionClient) updateCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.PrivateEndpointConnectionBody != nil { + return req, runtime.MarshalAsJSON(req, *options.PrivateEndpointConnectionBody) + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *PrivateEndpointConnectionClient) updateHandleResponse(resp *http.Response) (PrivateEndpointConnectionClientUpdateResponse, error) { + result := PrivateEndpointConnectionClientUpdateResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_privatelinkresource_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_privatelinkresource_client.go new file mode 100644 index 000000000000..947fa6996651 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_privatelinkresource_client.go @@ -0,0 +1,181 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// PrivateLinkResourceClient contains the methods for the PrivateLinkResource group. +// Don't use this type directly, use NewPrivateLinkResourceClient() instead. +type PrivateLinkResourceClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewPrivateLinkResourceClient creates a new instance of PrivateLinkResourceClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewPrivateLinkResourceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourceClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &PrivateLinkResourceClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Get - Get information related to a specific private Link Resource in the project. Returns a json object of type 'privateLinkResources' +// as specified in the models section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// privateLinkResourceName - Unique name of a private link resource within a project. +// options - PrivateLinkResourceClientGetOptions contains the optional parameters for the PrivateLinkResourceClient.Get method. +func (client *PrivateLinkResourceClient) Get(ctx context.Context, resourceGroupName string, projectName string, privateLinkResourceName string, options *PrivateLinkResourceClientGetOptions) (PrivateLinkResourceClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, privateLinkResourceName, options) + if err != nil { + return PrivateLinkResourceClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourceClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourceClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourceClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, privateLinkResourceName string, options *PrivateLinkResourceClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateLinkResources/{privateLinkResourceName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if privateLinkResourceName == "" { + return nil, errors.New("parameter privateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkResourceName}", url.PathEscape(privateLinkResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourceClient) getHandleResponse(resp *http.Response) (PrivateLinkResourceClientGetResponse, error) { + result := PrivateLinkResourceClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourceClientGetResponse{}, err + } + return result, nil +} + +// ListByProject - Get all private link resources created in the project. Returns a json array of objects of type 'privateLinkResources' +// as specified in the Models section. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - PrivateLinkResourceClientListByProjectOptions contains the optional parameters for the PrivateLinkResourceClient.ListByProject +// method. +func (client *PrivateLinkResourceClient) ListByProject(ctx context.Context, resourceGroupName string, projectName string, options *PrivateLinkResourceClientListByProjectOptions) (PrivateLinkResourceClientListByProjectResponse, error) { + req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return PrivateLinkResourceClientListByProjectResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return PrivateLinkResourceClientListByProjectResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return PrivateLinkResourceClientListByProjectResponse{}, runtime.NewResponseError(resp) + } + return client.listByProjectHandleResponse(resp) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *PrivateLinkResourceClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *PrivateLinkResourceClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentprojects/{projectName}/privateLinkResources" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *PrivateLinkResourceClient) listByProjectHandleResponse(resp *http.Response) (PrivateLinkResourceClientListByProjectResponse, error) { + result := PrivateLinkResourceClientListByProjectResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceCollection); err != nil { + return PrivateLinkResourceClientListByProjectResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_projects_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_projects_client.go new file mode 100644 index 000000000000..36f51b6e1348 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_projects_client.go @@ -0,0 +1,556 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// ProjectsClient contains the methods for the Projects group. +// Don't use this type directly, use NewProjectsClient() instead. +type ProjectsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewProjectsClient creates a new instance of ProjectsClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProjectsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ProjectsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// AssessmentOptions - Get all available options for the properties of an assessment on a project. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// assessmentOptionsName - Name of the assessment options. The only name accepted in default. +// options - ProjectsClientAssessmentOptionsOptions contains the optional parameters for the ProjectsClient.AssessmentOptions +// method. +func (client *ProjectsClient) AssessmentOptions(ctx context.Context, resourceGroupName string, projectName string, assessmentOptionsName string, options *ProjectsClientAssessmentOptionsOptions) (ProjectsClientAssessmentOptionsResponse, error) { + req, err := client.assessmentOptionsCreateRequest(ctx, resourceGroupName, projectName, assessmentOptionsName, options) + if err != nil { + return ProjectsClientAssessmentOptionsResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProjectsClientAssessmentOptionsResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProjectsClientAssessmentOptionsResponse{}, runtime.NewResponseError(resp) + } + return client.assessmentOptionsHandleResponse(resp) +} + +// assessmentOptionsCreateRequest creates the AssessmentOptions request. +func (client *ProjectsClient) assessmentOptionsCreateRequest(ctx context.Context, resourceGroupName string, projectName string, assessmentOptionsName string, options *ProjectsClientAssessmentOptionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessmentOptions/{assessmentOptionsName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if assessmentOptionsName == "" { + return nil, errors.New("parameter assessmentOptionsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentOptionsName}", url.PathEscape(assessmentOptionsName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// assessmentOptionsHandleResponse handles the AssessmentOptions response. +func (client *ProjectsClient) assessmentOptionsHandleResponse(resp *http.Response) (ProjectsClientAssessmentOptionsResponse, error) { + result := ProjectsClientAssessmentOptionsResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentOptions); err != nil { + return ProjectsClientAssessmentOptionsResponse{}, err + } + return result, nil +} + +// NewAssessmentOptionsListPager - Gets list of all available options for the properties of an assessment on a project. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - ProjectsClientAssessmentOptionsListOptions contains the optional parameters for the ProjectsClient.AssessmentOptionsList +// method. +func (client *ProjectsClient) NewAssessmentOptionsListPager(resourceGroupName string, projectName string, options *ProjectsClientAssessmentOptionsListOptions) *runtime.Pager[ProjectsClientAssessmentOptionsListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProjectsClientAssessmentOptionsListResponse]{ + More: func(page ProjectsClientAssessmentOptionsListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ProjectsClientAssessmentOptionsListResponse) (ProjectsClientAssessmentOptionsListResponse, error) { + req, err := client.assessmentOptionsListCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return ProjectsClientAssessmentOptionsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProjectsClientAssessmentOptionsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProjectsClientAssessmentOptionsListResponse{}, runtime.NewResponseError(resp) + } + return client.assessmentOptionsListHandleResponse(resp) + }, + }) +} + +// assessmentOptionsListCreateRequest creates the AssessmentOptionsList request. +func (client *ProjectsClient) assessmentOptionsListCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientAssessmentOptionsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/assessmentOptions" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// assessmentOptionsListHandleResponse handles the AssessmentOptionsList response. +func (client *ProjectsClient) assessmentOptionsListHandleResponse(resp *http.Response) (ProjectsClientAssessmentOptionsListResponse, error) { + result := ProjectsClientAssessmentOptionsListResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.AssessmentOptionsResultList); err != nil { + return ProjectsClientAssessmentOptionsListResponse{}, err + } + return result, nil +} + +// Create - Create a project with specified name. If a project already exists, update it. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - ProjectsClientCreateOptions contains the optional parameters for the ProjectsClient.Create method. +func (client *ProjectsClient) Create(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientCreateOptions) (ProjectsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return ProjectsClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProjectsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ProjectsClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *ProjectsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Project != nil { + return req, runtime.MarshalAsJSON(req, *options.Project) + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *ProjectsClient) createHandleResponse(resp *http.Response) (ProjectsClientCreateResponse, error) { + result := ProjectsClientCreateResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Project); err != nil { + return ProjectsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete the project. Deleting non-existent project is a no-operation. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - ProjectsClientDeleteOptions contains the optional parameters for the ProjectsClient.Delete method. +func (client *ProjectsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientDeleteOptions) (ProjectsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return ProjectsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProjectsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ProjectsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return client.deleteHandleResponse(resp) +} + +// deleteCreateRequest creates the Delete request. +func (client *ProjectsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *ProjectsClient) deleteHandleResponse(resp *http.Response) (ProjectsClientDeleteResponse, error) { + result := ProjectsClientDeleteResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + return result, nil +} + +// Get - Get the project with the specified name. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - ProjectsClientGetOptions contains the optional parameters for the ProjectsClient.Get method. +func (client *ProjectsClient) Get(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientGetOptions) (ProjectsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return ProjectsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProjectsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProjectsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ProjectsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProjectsClient) getHandleResponse(resp *http.Response) (ProjectsClientGetResponse, error) { + result := ProjectsClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Project); err != nil { + return ProjectsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get all the projects in the resource group. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// options - ProjectsClientListOptions contains the optional parameters for the ProjectsClient.List method. +func (client *ProjectsClient) NewListPager(resourceGroupName string, options *ProjectsClientListOptions) *runtime.Pager[ProjectsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProjectsClientListResponse]{ + More: func(page ProjectsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProjectsClientListResponse) (ProjectsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProjectsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProjectsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProjectsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ProjectsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *ProjectsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects" + 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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProjectsClient) listHandleResponse(resp *http.Response) (ProjectsClientListResponse, error) { + result := ProjectsClientListResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ProjectResultList); err != nil { + return ProjectsClientListResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get all the projects in the subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// options - ProjectsClientListBySubscriptionOptions contains the optional parameters for the ProjectsClient.ListBySubscription +// method. +func (client *ProjectsClient) NewListBySubscriptionPager(options *ProjectsClientListBySubscriptionOptions) *runtime.Pager[ProjectsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ProjectsClientListBySubscriptionResponse]{ + More: func(page ProjectsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProjectsClientListBySubscriptionResponse) (ProjectsClientListBySubscriptionResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listBySubscriptionCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ProjectsClientListBySubscriptionResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProjectsClientListBySubscriptionResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProjectsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) + } + return client.listBySubscriptionHandleResponse(resp) + }, + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ProjectsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ProjectsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Migrate/assessmentProjects" + 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.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ProjectsClient) listBySubscriptionHandleResponse(resp *http.Response) (ProjectsClientListBySubscriptionResponse, error) { + result := ProjectsClientListBySubscriptionResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ProjectResultList); err != nil { + return ProjectsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update a project with specified name. Supports partial updates, for example only tags can be provided. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - ProjectsClientUpdateOptions contains the optional parameters for the ProjectsClient.Update method. +func (client *ProjectsClient) Update(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientUpdateOptions) (ProjectsClientUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return ProjectsClientUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ProjectsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ProjectsClientUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *ProjectsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ProjectsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Project != nil { + return req, runtime.MarshalAsJSON(req, *options.Project) + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *ProjectsClient) updateHandleResponse(resp *http.Response) (ProjectsClientUpdateResponse, error) { + result := ProjectsClientUpdateResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.Project); err != nil { + return ProjectsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_response_types.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_response_types.go new file mode 100644 index 000000000000..624d24faa931 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_response_types.go @@ -0,0 +1,321 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +// AssessedMachinesClientGetResponse contains the response from method AssessedMachinesClient.Get. +type AssessedMachinesClientGetResponse struct { + AssessedMachine + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// AssessedMachinesClientListByAssessmentResponse contains the response from method AssessedMachinesClient.ListByAssessment. +type AssessedMachinesClientListByAssessmentResponse struct { + AssessedMachineResultList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// AssessmentsClientCreateResponse contains the response from method AssessmentsClient.Create. +type AssessmentsClientCreateResponse struct { + Assessment + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// AssessmentsClientDeleteResponse contains the response from method AssessmentsClient.Delete. +type AssessmentsClientDeleteResponse struct { + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// AssessmentsClientGetReportDownloadURLResponse contains the response from method AssessmentsClient.GetReportDownloadURL. +type AssessmentsClientGetReportDownloadURLResponse struct { + DownloadURL + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// AssessmentsClientGetResponse contains the response from method AssessmentsClient.Get. +type AssessmentsClientGetResponse struct { + Assessment + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// AssessmentsClientListByGroupResponse contains the response from method AssessmentsClient.ListByGroup. +type AssessmentsClientListByGroupResponse struct { + AssessmentResultList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// AssessmentsClientListByProjectResponse contains the response from method AssessmentsClient.ListByProject. +type AssessmentsClientListByProjectResponse struct { + AssessmentResultList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// GroupsClientCreateResponse contains the response from method GroupsClient.Create. +type GroupsClientCreateResponse struct { + Group + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// GroupsClientDeleteResponse contains the response from method GroupsClient.Delete. +type GroupsClientDeleteResponse struct { + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// GroupsClientGetResponse contains the response from method GroupsClient.Get. +type GroupsClientGetResponse struct { + Group + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// GroupsClientListByProjectResponse contains the response from method GroupsClient.ListByProject. +type GroupsClientListByProjectResponse struct { + GroupResultList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// GroupsClientUpdateMachinesResponse contains the response from method GroupsClient.UpdateMachines. +type GroupsClientUpdateMachinesResponse struct { + Group + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// HyperVCollectorsClientCreateResponse contains the response from method HyperVCollectorsClient.Create. +type HyperVCollectorsClientCreateResponse struct { + HyperVCollector + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// HyperVCollectorsClientDeleteResponse contains the response from method HyperVCollectorsClient.Delete. +type HyperVCollectorsClientDeleteResponse struct { + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// HyperVCollectorsClientGetResponse contains the response from method HyperVCollectorsClient.Get. +type HyperVCollectorsClientGetResponse struct { + HyperVCollector + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// HyperVCollectorsClientListByProjectResponse contains the response from method HyperVCollectorsClient.ListByProject. +type HyperVCollectorsClientListByProjectResponse struct { + HyperVCollectorList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ImportCollectorsClientCreateResponse contains the response from method ImportCollectorsClient.Create. +type ImportCollectorsClientCreateResponse struct { + ImportCollector + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ImportCollectorsClientDeleteResponse contains the response from method ImportCollectorsClient.Delete. +type ImportCollectorsClientDeleteResponse struct { + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ImportCollectorsClientGetResponse contains the response from method ImportCollectorsClient.Get. +type ImportCollectorsClientGetResponse struct { + ImportCollector + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ImportCollectorsClientListByProjectResponse contains the response from method ImportCollectorsClient.ListByProject. +type ImportCollectorsClientListByProjectResponse struct { + ImportCollectorList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// MachinesClientGetResponse contains the response from method MachinesClient.Get. +type MachinesClientGetResponse struct { + Machine + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// MachinesClientListByProjectResponse contains the response from method MachinesClient.ListByProject. +type MachinesClientListByProjectResponse struct { + MachineResultList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// OperationsClientListResponse contains the response from method OperationsClient.List. +type OperationsClientListResponse struct { + OperationResultList +} + +// PrivateEndpointConnectionClientDeleteResponse contains the response from method PrivateEndpointConnectionClient.Delete. +type PrivateEndpointConnectionClientDeleteResponse struct { + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// PrivateEndpointConnectionClientGetResponse contains the response from method PrivateEndpointConnectionClient.Get. +type PrivateEndpointConnectionClientGetResponse struct { + PrivateEndpointConnection + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// PrivateEndpointConnectionClientListByProjectResponse contains the response from method PrivateEndpointConnectionClient.ListByProject. +type PrivateEndpointConnectionClientListByProjectResponse struct { + PrivateEndpointConnectionCollection + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// PrivateEndpointConnectionClientUpdateResponse contains the response from method PrivateEndpointConnectionClient.Update. +type PrivateEndpointConnectionClientUpdateResponse struct { + PrivateEndpointConnection + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// PrivateLinkResourceClientGetResponse contains the response from method PrivateLinkResourceClient.Get. +type PrivateLinkResourceClientGetResponse struct { + PrivateLinkResource + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// PrivateLinkResourceClientListByProjectResponse contains the response from method PrivateLinkResourceClient.ListByProject. +type PrivateLinkResourceClientListByProjectResponse struct { + PrivateLinkResourceCollection + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ProjectsClientAssessmentOptionsListResponse contains the response from method ProjectsClient.AssessmentOptionsList. +type ProjectsClientAssessmentOptionsListResponse struct { + AssessmentOptionsResultList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ProjectsClientAssessmentOptionsResponse contains the response from method ProjectsClient.AssessmentOptions. +type ProjectsClientAssessmentOptionsResponse struct { + AssessmentOptions + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ProjectsClientCreateResponse contains the response from method ProjectsClient.Create. +type ProjectsClientCreateResponse struct { + Project + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ProjectsClientDeleteResponse contains the response from method ProjectsClient.Delete. +type ProjectsClientDeleteResponse struct { + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ProjectsClientGetResponse contains the response from method ProjectsClient.Get. +type ProjectsClientGetResponse struct { + Project + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ProjectsClientListBySubscriptionResponse contains the response from method ProjectsClient.ListBySubscription. +type ProjectsClientListBySubscriptionResponse struct { + ProjectResultList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ProjectsClientListResponse contains the response from method ProjectsClient.List. +type ProjectsClientListResponse struct { + ProjectResultList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ProjectsClientUpdateResponse contains the response from method ProjectsClient.Update. +type ProjectsClientUpdateResponse struct { + Project + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ServerCollectorsClientCreateResponse contains the response from method ServerCollectorsClient.Create. +type ServerCollectorsClientCreateResponse struct { + ServerCollector + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ServerCollectorsClientDeleteResponse contains the response from method ServerCollectorsClient.Delete. +type ServerCollectorsClientDeleteResponse struct { + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ServerCollectorsClientGetResponse contains the response from method ServerCollectorsClient.Get. +type ServerCollectorsClientGetResponse struct { + ServerCollector + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// ServerCollectorsClientListByProjectResponse contains the response from method ServerCollectorsClient.ListByProject. +type ServerCollectorsClientListByProjectResponse struct { + ServerCollectorList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// VMwareCollectorsClientCreateResponse contains the response from method VMwareCollectorsClient.Create. +type VMwareCollectorsClientCreateResponse struct { + VMwareCollector + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// VMwareCollectorsClientDeleteResponse contains the response from method VMwareCollectorsClient.Delete. +type VMwareCollectorsClientDeleteResponse struct { + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// VMwareCollectorsClientGetResponse contains the response from method VMwareCollectorsClient.Get. +type VMwareCollectorsClientGetResponse struct { + VMwareCollector + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} + +// VMwareCollectorsClientListByProjectResponse contains the response from method VMwareCollectorsClient.ListByProject. +type VMwareCollectorsClientListByProjectResponse struct { + VMwareCollectorList + // XMSRequestID contains the information returned from the x-ms-request-id header response. + XMSRequestID *string +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_servercollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_servercollectors_client.go new file mode 100644 index 000000000000..05cf50a13829 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_servercollectors_client.go @@ -0,0 +1,314 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// ServerCollectorsClient contains the methods for the ServerCollectors group. +// Don't use this type directly, use NewServerCollectorsClient() instead. +type ServerCollectorsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewServerCollectorsClient creates a new instance of ServerCollectorsClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewServerCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerCollectorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ServerCollectorsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Create - Create or Update Server collector +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// serverCollectorName - Unique name of a Server collector within a project. +// options - ServerCollectorsClientCreateOptions contains the optional parameters for the ServerCollectorsClient.Create method. +func (client *ServerCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientCreateOptions) (ServerCollectorsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, serverCollectorName, options) + if err != nil { + return ServerCollectorsClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServerCollectorsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ServerCollectorsClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *ServerCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if serverCollectorName == "" { + return nil, errors.New("parameter serverCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverCollectorName}", url.PathEscape(serverCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.CollectorBody != nil { + return req, runtime.MarshalAsJSON(req, *options.CollectorBody) + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *ServerCollectorsClient) createHandleResponse(resp *http.Response) (ServerCollectorsClientCreateResponse, error) { + result := ServerCollectorsClientCreateResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ServerCollector); err != nil { + return ServerCollectorsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Server collector from the project. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// serverCollectorName - Unique name of a Server collector within a project. +// options - ServerCollectorsClientDeleteOptions contains the optional parameters for the ServerCollectorsClient.Delete method. +func (client *ServerCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientDeleteOptions) (ServerCollectorsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, serverCollectorName, options) + if err != nil { + return ServerCollectorsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServerCollectorsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ServerCollectorsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return client.deleteHandleResponse(resp) +} + +// deleteCreateRequest creates the Delete request. +func (client *ServerCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if serverCollectorName == "" { + return nil, errors.New("parameter serverCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverCollectorName}", url.PathEscape(serverCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *ServerCollectorsClient) deleteHandleResponse(resp *http.Response) (ServerCollectorsClientDeleteResponse, error) { + result := ServerCollectorsClientDeleteResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + return result, nil +} + +// Get - Get a Server collector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// serverCollectorName - Unique name of a Server collector within a project. +// options - ServerCollectorsClientGetOptions contains the optional parameters for the ServerCollectorsClient.Get method. +func (client *ServerCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientGetOptions) (ServerCollectorsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, serverCollectorName, options) + if err != nil { + return ServerCollectorsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServerCollectorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServerCollectorsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ServerCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, serverCollectorName string, options *ServerCollectorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors/{serverCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if serverCollectorName == "" { + return nil, errors.New("parameter serverCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serverCollectorName}", url.PathEscape(serverCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ServerCollectorsClient) getHandleResponse(resp *http.Response) (ServerCollectorsClientGetResponse, error) { + result := ServerCollectorsClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ServerCollector); err != nil { + return ServerCollectorsClientGetResponse{}, err + } + return result, nil +} + +// NewListByProjectPager - Get a list of Server collector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - ServerCollectorsClientListByProjectOptions contains the optional parameters for the ServerCollectorsClient.ListByProject +// method. +func (client *ServerCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *ServerCollectorsClientListByProjectOptions) *runtime.Pager[ServerCollectorsClientListByProjectResponse] { + return runtime.NewPager(runtime.PagingHandler[ServerCollectorsClientListByProjectResponse]{ + More: func(page ServerCollectorsClientListByProjectResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *ServerCollectorsClientListByProjectResponse) (ServerCollectorsClientListByProjectResponse, error) { + req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return ServerCollectorsClientListByProjectResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ServerCollectorsClientListByProjectResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ServerCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) + } + return client.listByProjectHandleResponse(resp) + }, + }) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *ServerCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *ServerCollectorsClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/servercollectors" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *ServerCollectorsClient) listByProjectHandleResponse(resp *http.Response) (ServerCollectorsClientListByProjectResponse, error) { + result := ServerCollectorsClientListByProjectResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ServerCollectorList); err != nil { + return ServerCollectorsClientListByProjectResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_time_rfc3339.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_time_rfc3339.go new file mode 100644 index 000000000000..c95bd4b4f714 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_time_rfc3339.go @@ -0,0 +1,86 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "encoding/json" + "fmt" + "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, fn string, 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 fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/migrate/armmigrate/zz_generated_vmwarecollectors_client.go b/sdk/resourcemanager/migrate/armmigrate/zz_generated_vmwarecollectors_client.go new file mode 100644 index 000000000000..735b03e20d36 --- /dev/null +++ b/sdk/resourcemanager/migrate/armmigrate/zz_generated_vmwarecollectors_client.go @@ -0,0 +1,314 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armmigrate + +import ( + "context" + "errors" + "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/cloud" + "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" +) + +// VMwareCollectorsClient contains the methods for the VMwareCollectors group. +// Don't use this type directly, use NewVMwareCollectorsClient() instead. +type VMwareCollectorsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewVMwareCollectorsClient creates a new instance of VMwareCollectorsClient with the specified values. +// subscriptionID - Azure Subscription Id in which project was created. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewVMwareCollectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VMwareCollectorsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &VMwareCollectorsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// Create - Create or Update VMware collector +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// vmWareCollectorName - Unique name of a VMware collector within a project. +// options - VMwareCollectorsClientCreateOptions contains the optional parameters for the VMwareCollectorsClient.Create method. +func (client *VMwareCollectorsClient) Create(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientCreateOptions) (VMwareCollectorsClientCreateResponse, error) { + req, err := client.createCreateRequest(ctx, resourceGroupName, projectName, vmWareCollectorName, options) + if err != nil { + return VMwareCollectorsClientCreateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VMwareCollectorsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return VMwareCollectorsClientCreateResponse{}, runtime.NewResponseError(resp) + } + return client.createHandleResponse(resp) +} + +// createCreateRequest creates the Create request. +func (client *VMwareCollectorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if vmWareCollectorName == "" { + return nil, errors.New("parameter vmWareCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmWareCollectorName}", url.PathEscape(vmWareCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.CollectorBody != nil { + return req, runtime.MarshalAsJSON(req, *options.CollectorBody) + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *VMwareCollectorsClient) createHandleResponse(resp *http.Response) (VMwareCollectorsClientCreateResponse, error) { + result := VMwareCollectorsClientCreateResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.VMwareCollector); err != nil { + return VMwareCollectorsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a VMware collector from the project. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// vmWareCollectorName - Unique name of a VMware collector within a project. +// options - VMwareCollectorsClientDeleteOptions contains the optional parameters for the VMwareCollectorsClient.Delete method. +func (client *VMwareCollectorsClient) Delete(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientDeleteOptions) (VMwareCollectorsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, projectName, vmWareCollectorName, options) + if err != nil { + return VMwareCollectorsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VMwareCollectorsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return VMwareCollectorsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return client.deleteHandleResponse(resp) +} + +// deleteCreateRequest creates the Delete request. +func (client *VMwareCollectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if vmWareCollectorName == "" { + return nil, errors.New("parameter vmWareCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmWareCollectorName}", url.PathEscape(vmWareCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *VMwareCollectorsClient) deleteHandleResponse(resp *http.Response) (VMwareCollectorsClientDeleteResponse, error) { + result := VMwareCollectorsClientDeleteResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + return result, nil +} + +// Get - Get a VMware collector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// vmWareCollectorName - Unique name of a VMware collector within a project. +// options - VMwareCollectorsClientGetOptions contains the optional parameters for the VMwareCollectorsClient.Get method. +func (client *VMwareCollectorsClient) Get(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientGetOptions) (VMwareCollectorsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, projectName, vmWareCollectorName, options) + if err != nil { + return VMwareCollectorsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VMwareCollectorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VMwareCollectorsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *VMwareCollectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, projectName string, vmWareCollectorName string, options *VMwareCollectorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors/{vmWareCollectorName}" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + if vmWareCollectorName == "" { + return nil, errors.New("parameter vmWareCollectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vmWareCollectorName}", url.PathEscape(vmWareCollectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *VMwareCollectorsClient) getHandleResponse(resp *http.Response) (VMwareCollectorsClientGetResponse, error) { + result := VMwareCollectorsClientGetResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.VMwareCollector); err != nil { + return VMwareCollectorsClientGetResponse{}, err + } + return result, nil +} + +// NewListByProjectPager - Get a list of VMware collector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2019-10-01 +// resourceGroupName - Name of the Azure Resource Group that project is part of. +// projectName - Name of the Azure Migrate project. +// options - VMwareCollectorsClientListByProjectOptions contains the optional parameters for the VMwareCollectorsClient.ListByProject +// method. +func (client *VMwareCollectorsClient) NewListByProjectPager(resourceGroupName string, projectName string, options *VMwareCollectorsClientListByProjectOptions) *runtime.Pager[VMwareCollectorsClientListByProjectResponse] { + return runtime.NewPager(runtime.PagingHandler[VMwareCollectorsClientListByProjectResponse]{ + More: func(page VMwareCollectorsClientListByProjectResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *VMwareCollectorsClientListByProjectResponse) (VMwareCollectorsClientListByProjectResponse, error) { + req, err := client.listByProjectCreateRequest(ctx, resourceGroupName, projectName, options) + if err != nil { + return VMwareCollectorsClientListByProjectResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return VMwareCollectorsClientListByProjectResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return VMwareCollectorsClientListByProjectResponse{}, runtime.NewResponseError(resp) + } + return client.listByProjectHandleResponse(resp) + }, + }) +} + +// listByProjectCreateRequest creates the ListByProject request. +func (client *VMwareCollectorsClient) listByProjectCreateRequest(ctx context.Context, resourceGroupName string, projectName string, options *VMwareCollectorsClientListByProjectOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/assessmentProjects/{projectName}/vmwarecollectors" + 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 projectName == "" { + return nil, errors.New("parameter projectName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2019-10-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByProjectHandleResponse handles the ListByProject response. +func (client *VMwareCollectorsClient) listByProjectHandleResponse(resp *http.Response) (VMwareCollectorsClientListByProjectResponse, error) { + result := VMwareCollectorsClientListByProjectResponse{} + if val := resp.Header.Get("x-ms-request-id"); val != "" { + result.XMSRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.VMwareCollectorList); err != nil { + return VMwareCollectorsClientListByProjectResponse{}, err + } + return result, nil +}