From 869b3a0d8b7fdd8f882481dc7428f72785219e5e Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Wed, 17 Nov 2021 07:12:58 -0600 Subject: [PATCH 1/7] dotnet new azuremgmt --provider Microsoft.Avs --tagVersion package-2021-12-01 --includeCI --- sdk/.vscode/tasks.json | 42 ++++++++++ .../Azure.ResourceManager.Avs.sln | 51 ++++++++++++ .../Azure.ResourceManager.Avs/CHANGELOG.md | 7 ++ .../Directory.Build.props | 6 ++ sdk/avs/Azure.ResourceManager.Avs/README.md | 77 +++++++++++++++++++ .../src/Azure.ResourceManager.Avs.csproj | 8 ++ .../src/Properties/AssemblyInfo.cs | 8 ++ .../Azure.ResourceManager.Avs/src/autorest.md | 11 +++ .../tests/AvsManagementTestEnvironment.cs | 11 +++ .../Azure.ResourceManager.Avs.Tests.csproj | 5 ++ .../.runsettings | 20 +++++ .../.vscode/tasks.json | 42 ++++++++++ sdk/avs/ci.yml | 31 ++++++++ sdk/avs/test-resources.json | 6 ++ 14 files changed, 325 insertions(+) create mode 100644 sdk/.vscode/tasks.json create mode 100644 sdk/avs/Azure.ResourceManager.Avs/Azure.ResourceManager.Avs.sln create mode 100644 sdk/avs/Azure.ResourceManager.Avs/CHANGELOG.md create mode 100644 sdk/avs/Azure.ResourceManager.Avs/Directory.Build.props create mode 100644 sdk/avs/Azure.ResourceManager.Avs/README.md create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Azure.ResourceManager.Avs.csproj create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Properties/AssemblyInfo.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/autorest.md create mode 100644 sdk/avs/Azure.ResourceManager.Avs/tests/AvsManagementTestEnvironment.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/tests/Azure.ResourceManager.Avs.Tests.csproj create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/.runsettings create mode 100644 sdk/avs/Microsoft.Azure.Management.Avs/.vscode/tasks.json create mode 100644 sdk/avs/ci.yml create mode 100644 sdk/avs/test-resources.json diff --git a/sdk/.vscode/tasks.json b/sdk/.vscode/tasks.json new file mode 100644 index 000000000000..0e07ca782ad3 --- /dev/null +++ b/sdk/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/customproviders/Microsoft.Azure.Management.CustomProviders/tests/Microsoft.Azure.Management.CustomProviders.Tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/customproviders/Microsoft.Azure.Management.CustomProviders/tests/Microsoft.Azure.Management.CustomProviders.Tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/customproviders/Microsoft.Azure.Management.CustomProviders/tests/Microsoft.Azure.Management.CustomProviders.Tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/sdk/avs/Azure.ResourceManager.Avs/Azure.ResourceManager.Avs.sln b/sdk/avs/Azure.ResourceManager.Avs/Azure.ResourceManager.Avs.sln new file mode 100644 index 000000000000..caeb723d2ae6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/Azure.ResourceManager.Avs.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30309.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{899FB17D-4DC6-43D7-A391-EEA18A149BB5}") = "Azure.ResourceManager.Avs", "src\Azure.ResourceManager.Avs.csproj", "{8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}" +EndProject +Project("{899FB17D-4DC6-43D7-A391-EEA18A149BB5}") = "Azure.ResourceManager.Avs.Tests", "tests\Azure.ResourceManager.Avs.Tests.csproj", "{F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}" +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {86ED4C64-C66D-4CCF-A0DA-CCB59162C299} + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Debug|x64.ActiveCfg = Debug|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Debug|x64.Build.0 = Debug|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Debug|x86.ActiveCfg = Debug|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Debug|x86.Build.0 = Debug|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Release|Any CPU.Build.0 = Release|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Release|x64.ActiveCfg = Release|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Release|x64.Build.0 = Release|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Release|x86.ActiveCfg = Release|Any CPU + {8BC02799-7B2F-425F-BB6F-9BA3BBB2B460}.Release|x86.Build.0 = Release|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Debug|x64.ActiveCfg = Debug|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Debug|x64.Build.0 = Debug|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Debug|x86.ActiveCfg = Debug|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Debug|x86.Build.0 = Debug|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Release|Any CPU.Build.0 = Release|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Release|x64.ActiveCfg = Release|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Release|x64.Build.0 = Release|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Release|x86.ActiveCfg = Release|Any CPU + {F32C13B8-1004-4716-8FEE-7B5AB7FEDB5E}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/sdk/avs/Azure.ResourceManager.Avs/CHANGELOG.md b/sdk/avs/Azure.ResourceManager.Avs/CHANGELOG.md new file mode 100644 index 000000000000..3d4ff921b5b6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/CHANGELOG.md @@ -0,0 +1,7 @@ +# Release History + +## 1.0.0-preview.1 (Unreleased) + +This package follows the [Azure SDK Design Guidelines for .NET](https://azure.github.io/azure-sdk/dotnet_introduction.html) which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more. + +This is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, please submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). \ No newline at end of file diff --git a/sdk/avs/Azure.ResourceManager.Avs/Directory.Build.props b/sdk/avs/Azure.ResourceManager.Avs/Directory.Build.props new file mode 100644 index 000000000000..1a9611bd4924 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/avs/Azure.ResourceManager.Avs/README.md b/sdk/avs/Azure.ResourceManager.Avs/README.md new file mode 100644 index 000000000000..1e61ae449f14 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/README.md @@ -0,0 +1,77 @@ +# Azure Avs Management client library for .NET + +This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html) which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more. + +## Getting started + +### Install the package + +Install the Azure Avs management library for .NET with [NuGet](https://www.nuget.org/): + +```PowerShell +Install-Package Azure.ResourceManager.Avs -Version 1.0.0-preview.1 +``` + +### Prerequisites + +* You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) + +### Authenticate the Client + +To create an authenticated client and start interacting with Azure resources, please see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/mgmt_preview_quickstart.md) + +## Key concepts + +Key concepts of the Azure .NET SDK can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/mgmt_preview_quickstart.md) +- [API References](https://docs.microsoft.com/dotnet/api/?view=azure-dotnet) +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md) + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://docs.microsoft.com/samples/browse/?branch=master&languages=csharp&term=managing%20using%20Azure%20.NET%20SDK) + +## Troubleshooting + +- File an issue via [Github + Issues](https://github.com/Azure/azure-sdk-for-net/issues) +- Check [previous + questions](https://stackoverflow.com/questions/tagged/azure+.net) + or ask new ones on Stack Overflow using azure and .net tags. + + +## Next steps + +For more information on Azure SDK, please refer to [this website](https://azure.github.io/azure-sdk/) + +## Contributing + +For details on contributing to this repository, see the contributing +guide. + +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 . + +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 repositories using +our CLA. + +This project has adopted the Microsoft Open Source Code of Conduct. For +more information see the Code of Conduct FAQ or contact + with any additional questions or comments. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Ftemplate%2FAzure.Template%2FREADME.png) \ No newline at end of file diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Azure.ResourceManager.Avs.csproj b/sdk/avs/Azure.ResourceManager.Avs/src/Azure.ResourceManager.Avs.csproj new file mode 100644 index 000000000000..3f6e7965c8c6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Azure.ResourceManager.Avs.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.Avs + Azure Resource Manager client SDK for Azure resource provider Microsoft.Avs + azure;management;arm;resource manager;avs + + diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Properties/AssemblyInfo.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..0f8bd16b0444 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Properties/AssemblyInfo.cs @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Avs")] + +[assembly: InternalsVisibleTo("Azure.ResourceManager.Avs.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md b/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md new file mode 100644 index 000000000000..c8f7843beaf6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md @@ -0,0 +1,11 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml + +azure-arm: true +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/avs/resource-manager/readme.md +tag: package-2021-12-01 + +``` \ No newline at end of file diff --git a/sdk/avs/Azure.ResourceManager.Avs/tests/AvsManagementTestEnvironment.cs b/sdk/avs/Azure.ResourceManager.Avs/tests/AvsManagementTestEnvironment.cs new file mode 100644 index 000000000000..24a8274a8480 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/tests/AvsManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.Avs.Tests +{ + public class AvsManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/avs/Azure.ResourceManager.Avs/tests/Azure.ResourceManager.Avs.Tests.csproj b/sdk/avs/Azure.ResourceManager.Avs/tests/Azure.ResourceManager.Avs.Tests.csproj new file mode 100644 index 000000000000..8d36a7ec7383 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/tests/Azure.ResourceManager.Avs.Tests.csproj @@ -0,0 +1,5 @@ + + + + + diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/.runsettings b/sdk/avs/Microsoft.Azure.Management.Avs/.runsettings new file mode 100644 index 000000000000..6398cb93d2bb --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/.runsettings @@ -0,0 +1,20 @@ + + + + + + http://localhost:8888 + Record + + + + + + + + + SubscriptionId=ba75e79b-dd95-4025-9dbf-3a7ae8dff2b5;ServicePrincipal=690b56ab-007b-4342-ab59-9bf340c560a0;ServicePrincipalSecret=bjK7Q~jFMUztv8koNR1~tWvNyvUwbIJgHNrvV;AADTenant=f686d426-8d16-42db-81b7-ab578e110ccd;Environment=Dogfood;ResourceManagementUri=https://localhost;HttpRecorderMode=Record;GraphUri=https://localhost;AADAuthUri=https://localhost/adfs/ + + + + \ No newline at end of file diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/.vscode/tasks.json b/sdk/avs/Microsoft.Azure.Management.Avs/.vscode/tasks.json new file mode 100644 index 000000000000..737875b63406 --- /dev/null +++ b/sdk/avs/Microsoft.Azure.Management.Avs/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/tests/Microsoft.Azure.Management.Avs.Tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/tests/Microsoft.Azure.Management.Avs.Tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/tests/Microsoft.Azure.Management.Avs.Tests.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/sdk/avs/ci.yml b/sdk/avs/ci.yml new file mode 100644 index 000000000000..6ec602e603f2 --- /dev/null +++ b/sdk/avs/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/avs/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/avs/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: avs + ArtifactName: packages + Artifacts: + - name: Azure.ResourceManager.Avs + safeName: AzureResourceManagerAvs diff --git a/sdk/avs/test-resources.json b/sdk/avs/test-resources.json new file mode 100644 index 000000000000..a837d5a0f2b8 --- /dev/null +++ b/sdk/avs/test-resources.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + ] +} From 02aa95039a921c73eb3d219beff45869a489a959 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Wed, 17 Nov 2021 10:16:28 -0600 Subject: [PATCH 2/7] initial autorest config --- .../Azure.ResourceManager.Avs/src/autorest.md | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md b/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md index c8f7843beaf6..f720c8b6c597 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md +++ b/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md @@ -5,7 +5,21 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/avs/resource-manager/readme.md +security: AADToken +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/c4d6f92d3fd35a69ebce68f4c73c35c4238c2ac5/specification/vmware/resource-manager/readme.md tag: package-2021-12-01 - -``` \ No newline at end of file +model-namespace: false +operation-group-to-resource-type: + Locations: Microsoft.AVS/locations + VirtualMachines: Microsoft.AVS/privateClouds/clusters/virtualMachines + ScriptPackages: Microsoft.AVS/privateClouds/scriptPackages + ScriptCmdlets: Microsoft.AVS/privateClouds/scriptPackages/scriptCmdlets +operation-group-to-parent: + Locations: subscriptions + WorkloadNetworks: Microsoft.AVS/privateClouds +operation-group-to-resource: + Locations: NonResource + VirtualMachines: NonResource + ScriptPackages: NonResource + ScriptCmdlets: NonResource +``` From 185bc2db0eed5caa8d74456d22b83e54e55863e4 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Wed, 17 Nov 2021 10:52:53 -0600 Subject: [PATCH 3/7] generate --- .../src/Generated/Addon.cs | 187 + .../src/Generated/AddonCollection.cs | 361 ++ .../src/Generated/AddonData.cs | 35 + .../src/Generated/CloudLink.cs | 187 + .../src/Generated/CloudLinkCollection.cs | 361 ++ .../src/Generated/CloudLinkData.cs | 39 + .../src/Generated/Cluster.cs | 374 ++ .../src/Generated/ClusterCollection.cs | 361 ++ .../src/Generated/ClusterData.cs | 63 + .../src/Generated/Datastore.cs | 187 + .../src/Generated/DatastoreCollection.cs | 361 ++ .../src/Generated/DatastoreData.cs | 48 + .../Generated/ExpressRouteAuthorization.cs | 187 + .../ExpressRouteAuthorizationCollection.cs | 361 ++ .../ExpressRouteAuthorizationData.cs | 47 + .../Extensions/ArmClientExtensions.cs | 136 + .../Extensions/ResourceGroupExtensions.cs | 25 + .../Extensions/SubscriptionExtensions.cs | 286 ++ .../src/Generated/GlobalReachConnection.cs | 187 + .../GlobalReachConnectionCollection.cs | 361 ++ .../Generated/GlobalReachConnectionData.cs | 55 + .../src/Generated/HcxEnterpriseSite.cs | 187 + .../Generated/HcxEnterpriseSiteCollection.cs | 361 ++ .../src/Generated/HcxEnterpriseSiteData.cs | 39 + .../AddonCreateOrUpdateOperation.cs | 77 + .../AddonDeleteOperation.cs | 53 + .../AuthorizationCreateOrUpdateOperation.cs | 77 + .../AuthorizationDeleteOperation.cs | 53 + .../CloudLinkCreateOrUpdateOperation.cs | 77 + .../CloudLinkDeleteOperation.cs | 53 + .../ClusterCreateOrUpdateOperation.cs | 77 + .../ClusterDeleteOperation.cs | 53 + .../ClusterUpdateOperation.cs | 77 + .../DatastoreCreateOrUpdateOperation.cs | 77 + .../DatastoreDeleteOperation.cs | 53 + ...lReachConnectionCreateOrUpdateOperation.cs | 77 + .../GlobalReachConnectionDeleteOperation.cs | 53 + ...cxEnterpriseSiteCreateOrUpdateOperation.cs | 60 + .../HcxEnterpriseSiteDeleteOperation.cs | 52 + .../PlacementPolicyCreateOrUpdateOperation.cs | 77 + .../PlacementPolicyDeleteOperation.cs | 53 + .../PlacementPolicyUpdateOperation.cs | 77 + .../PrivateCloudCreateOrUpdateOperation.cs | 77 + .../PrivateCloudDeleteOperation.cs | 53 + ...PrivateCloudRotateNsxtPasswordOperation.cs | 53 + ...vateCloudRotateVcenterPasswordOperation.cs | 53 + .../PrivateCloudUpdateOperation.cs | 77 + .../ScriptExecutionCreateOrUpdateOperation.cs | 77 + .../ScriptExecutionDeleteOperation.cs | 53 + ...VirtualMachineRestrictMovementOperation.cs | 53 + .../WorkloadNetworkCreateDhcpOperation.cs | 72 + ...orkloadNetworkCreateDnsServiceOperation.cs | 72 + .../WorkloadNetworkCreateDnsZoneOperation.cs | 72 + ...loadNetworkCreatePortMirroringOperation.cs | 72 + .../WorkloadNetworkCreatePublicIPOperation.cs | 72 + .../WorkloadNetworkCreateSegmentsOperation.cs | 77 + .../WorkloadNetworkCreateVMGroupOperation.cs | 72 + .../WorkloadNetworkDeleteDhcpOperation.cs | 53 + ...orkloadNetworkDeleteDnsServiceOperation.cs | 53 + .../WorkloadNetworkDeleteDnsZoneOperation.cs | 53 + ...loadNetworkDeletePortMirroringOperation.cs | 53 + .../WorkloadNetworkDeletePublicIPOperation.cs | 53 + .../WorkloadNetworkDeleteSegmentOperation.cs | 53 + .../WorkloadNetworkDeleteVMGroupOperation.cs | 53 + .../WorkloadNetworkUpdateDhcpOperation.cs | 72 + ...orkloadNetworkUpdateDnsServiceOperation.cs | 72 + .../WorkloadNetworkUpdateDnsZoneOperation.cs | 72 + ...loadNetworkUpdatePortMirroringOperation.cs | 72 + .../WorkloadNetworkUpdateSegmentsOperation.cs | 77 + .../WorkloadNetworkUpdateVMGroupOperation.cs | 72 + .../Models/AddonData.Serialization.cs | 65 + .../AddonHcxProperties.Serialization.cs | 56 + .../Generated/Models/AddonHcxProperties.cs | 42 + .../Models/AddonList.Serialization.cs | 47 + .../src/Generated/Models/AddonList.cs | 37 + .../Models/AddonProperties.Serialization.cs | 57 + .../src/Generated/Models/AddonProperties.cs | 32 + .../Models/AddonProvisioningState.cs | 63 + .../AddonSrmProperties.Serialization.cs | 59 + .../Generated/Models/AddonSrmProperties.cs | 32 + .../src/Generated/Models/AddonType.cs | 54 + .../Models/AddonVrProperties.Serialization.cs | 56 + .../src/Generated/Models/AddonVrProperties.cs | 34 + .../Models/AdminCredentials.Serialization.cs | 47 + .../src/Generated/Models/AdminCredentials.cs | 40 + .../src/Generated/Models/AffinityType.cs | 51 + .../AvailabilityProperties.Serialization.cs | 77 + .../Models/AvailabilityProperties.cs | 36 + .../Generated/Models/AvailabilityStrategy.cs | 51 + .../Generated/Models/Circuit.Serialization.cs | 53 + .../src/Generated/Models/Circuit.cs | 40 + .../Models/CloudLinkData.Serialization.cs | 86 + .../Models/CloudLinkList.Serialization.cs | 47 + .../src/Generated/Models/CloudLinkList.cs | 37 + .../src/Generated/Models/CloudLinkStatus.cs | 60 + .../Models/ClusterData.Serialization.cs | 137 + .../Models/ClusterList.Serialization.cs | 47 + .../src/Generated/Models/ClusterList.cs | 37 + .../Models/ClusterProperties.Serialization.cs | 94 + .../src/Generated/Models/ClusterProperties.cs | 29 + .../Models/ClusterProvisioningState.cs | 60 + .../Models/ClusterUpdate.Serialization.cs | 39 + .../src/Generated/Models/ClusterUpdate.cs | 27 + .../CommonClusterProperties.Serialization.cs | 94 + .../Models/CommonClusterProperties.cs | 44 + .../Models/DatastoreData.Serialization.cs | 119 + .../Models/DatastoreList.Serialization.cs | 47 + .../src/Generated/Models/DatastoreList.cs | 37 + .../Models/DatastoreProvisioningState.cs | 66 + .../src/Generated/Models/DatastoreStatus.cs | 66 + .../src/Generated/Models/DhcpTypeEnum.cs | 51 + .../Models/DiskPoolVolume.Serialization.cs | 67 + .../src/Generated/Models/DiskPoolVolume.cs | 56 + .../Models/DnsServiceLogLevelEnum.cs | 60 + .../Generated/Models/DnsServiceStatusEnum.cs | 51 + .../Models/Encryption.Serialization.cs | 61 + .../src/Generated/Models/Encryption.cs | 32 + .../Generated/Models/EncryptionKeyStatus.cs | 51 + ...ryptionKeyVaultProperties.Serialization.cs | 84 + .../Models/EncryptionKeyVaultProperties.cs | 44 + .../src/Generated/Models/EncryptionState.cs | 51 + .../Generated/Models/EncryptionVersionType.cs | 51 + .../Models/Endpoints.Serialization.cs | 41 + .../src/Generated/Models/Endpoints.cs | 36 + ...essRouteAuthorizationData.Serialization.cs | 98 + ...essRouteAuthorizationList.Serialization.cs | 47 + .../Models/ExpressRouteAuthorizationList.cs | 37 + ...ressRouteAuthorizationProvisioningState.cs | 54 + ...GlobalReachConnectionData.Serialization.cs | 125 + ...GlobalReachConnectionList.Serialization.cs | 47 + .../Models/GlobalReachConnectionList.cs | 37 + .../GlobalReachConnectionProvisioningState.cs | 54 + .../Models/GlobalReachConnectionStatus.cs | 54 + .../HcxEnterpriseSiteData.Serialization.cs | 81 + .../HcxEnterpriseSiteList.Serialization.cs | 47 + .../Generated/Models/HcxEnterpriseSiteList.cs | 37 + .../Models/HcxEnterpriseSiteStatus.cs | 57 + .../Models/IdentitySource.Serialization.cs | 144 + .../src/Generated/Models/IdentitySource.cs | 64 + .../src/Generated/Models/InternetEnum.cs | 51 + .../Models/ManagementCluster.Serialization.cs | 94 + .../src/Generated/Models/ManagementCluster.cs | 29 + .../src/Generated/Models/MountOptionEnum.cs | 51 + .../src/Generated/Models/OptionalParamEnum.cs | 51 + ...dentialExecutionParameter.Serialization.cs | 67 + .../Models/PSCredentialExecutionParameter.cs | 45 + .../PlacementPoliciesList.Serialization.cs | 47 + .../Generated/Models/PlacementPoliciesList.cs | 37 + .../PlacementPolicyData.Serialization.cs | 65 + ...PlacementPolicyProperties.Serialization.cs | 83 + .../Models/PlacementPolicyProperties.cs | 40 + .../PlacementPolicyProvisioningState.cs | 60 + .../Generated/Models/PlacementPolicyState.cs | 51 + .../Generated/Models/PlacementPolicyType.cs | 51 + .../PlacementPolicyUpdate.Serialization.cs | 49 + .../Generated/Models/PlacementPolicyUpdate.cs | 30 + .../Models/PortMirroringDirectionEnum.cs | 54 + .../Models/PortMirroringStatusEnum.cs | 51 + .../Models/PrivateCloudData.Serialization.cs | 340 ++ .../PrivateCloudIdentity.Serialization.cs | 57 + .../Generated/Models/PrivateCloudIdentity.cs | 36 + .../Models/PrivateCloudList.Serialization.cs | 47 + .../src/Generated/Models/PrivateCloudList.cs | 37 + .../PrivateCloudProperties.Serialization.cs | 13 + .../Models/PrivateCloudProperties.cs | 58 + .../Models/PrivateCloudProvisioningState.cs | 66 + .../PrivateCloudUpdate.Serialization.cs | 70 + .../Generated/Models/PrivateCloudUpdate.cs | 38 + ...vateCloudUpdateProperties.Serialization.cs | 13 + .../Models/PrivateCloudUpdateProperties.cs | 33 + .../Generated/Models/Quota.Serialization.cs | 51 + .../src/Generated/Models/Quota.cs | 36 + .../src/Generated/Models/QuotaEnabled.cs | 51 + .../Generated/Models/ResourceIdentityType.cs | 51 + .../Models/ScriptCmdlet.Serialization.cs | 92 + .../src/Generated/Models/ScriptCmdlet.cs | 45 + .../Models/ScriptCmdletsList.Serialization.cs | 46 + .../src/Generated/Models/ScriptCmdletsList.cs | 36 + .../ScriptExecutionData.Serialization.cs | 307 ++ .../ScriptExecutionParameter.Serialization.cs | 54 + .../Models/ScriptExecutionParameter.cs | 42 + .../Models/ScriptExecutionParameterType.cs | 54 + .../ScriptExecutionProvisioningState.cs | 66 + .../ScriptExecutionsList.Serialization.cs | 47 + .../Generated/Models/ScriptExecutionsList.cs | 37 + .../Models/ScriptOutputStreamType.cs | 57 + .../Models/ScriptPackage.Serialization.cs | 75 + .../src/Generated/Models/ScriptPackage.cs | 38 + .../ScriptPackagesList.Serialization.cs | 46 + .../Generated/Models/ScriptPackagesList.cs | 36 + .../Models/ScriptParameter.Serialization.cs | 68 + .../src/Generated/Models/ScriptParameter.cs | 44 + .../Generated/Models/ScriptParameterTypes.cs | 63 + ...eStringExecutionParameter.Serialization.cs | 56 + .../ScriptSecureStringExecutionParameter.cs | 41 + ...tStringExecutionParameter.Serialization.cs | 56 + .../Models/ScriptStringExecutionParameter.cs | 41 + .../src/Generated/Models/SegmentStatusEnum.cs | 51 + .../src/Generated/Models/Sku.Serialization.cs | 37 + .../src/Generated/Models/Sku.cs | 31 + .../src/Generated/Models/SslEnum.cs | 51 + .../Generated/Models/Trial.Serialization.cs | 45 + .../src/Generated/Models/Trial.cs | 32 + .../src/Generated/Models/TrialStatus.cs | 54 + .../src/Generated/Models/VMGroupStatusEnum.cs | 51 + .../src/Generated/Models/VMTypeEnum.cs | 54 + .../Models/VirtualMachine.Serialization.cs | 92 + .../src/Generated/Models/VirtualMachine.cs | 46 + ...alMachineRestrictMovement.Serialization.cs | 26 + .../Models/VirtualMachineRestrictMovement.cs | 21 + .../VirtualMachineRestrictMovementState.cs | 51 + .../VirtualMachinesList.Serialization.cs | 46 + .../Generated/Models/VirtualMachinesList.cs | 36 + .../Models/VisibilityParameterEnum.cs | 51 + ...PlacementPolicyProperties.Serialization.cs | 120 + .../Models/VmHostPlacementPolicyProperties.cs | 62 + ...PlacementPolicyProperties.Serialization.cs | 102 + .../Models/VmPlacementPolicyProperties.cs | 52 + .../WorkloadNetworkDhcp.Serialization.cs | 64 + .../Generated/Models/WorkloadNetworkDhcp.cs | 34 + ...WorkloadNetworkDhcpEntity.Serialization.cs | 100 + .../Models/WorkloadNetworkDhcpEntity.cs | 48 + .../WorkloadNetworkDhcpList.Serialization.cs | 46 + .../Models/WorkloadNetworkDhcpList.cs | 36 + .../WorkloadNetworkDhcpProvisioningState.cs | 60 + .../WorkloadNetworkDhcpRelay.Serialization.cs | 118 + .../Models/WorkloadNetworkDhcpRelay.cs | 39 + ...WorkloadNetworkDhcpServer.Serialization.cs | 119 + .../Models/WorkloadNetworkDhcpServer.cs | 41 + ...WorkloadNetworkDnsService.Serialization.cs | 177 + .../Models/WorkloadNetworkDnsService.cs | 65 + ...kloadNetworkDnsServiceProvisioningState.cs | 60 + ...oadNetworkDnsServicesList.Serialization.cs | 46 + .../Models/WorkloadNetworkDnsServicesList.cs | 36 + .../WorkloadNetworkDnsZone.Serialization.cs | 181 + .../Models/WorkloadNetworkDnsZone.cs | 62 + ...WorkloadNetworkDnsZoneProvisioningState.cs | 60 + ...rkloadNetworkDnsZonesList.Serialization.cs | 46 + .../Models/WorkloadNetworkDnsZonesList.cs | 36 + .../WorkloadNetworkGateway.Serialization.cs | 80 + .../Models/WorkloadNetworkGateway.cs | 38 + ...orkloadNetworkGatewayList.Serialization.cs | 46 + .../Models/WorkloadNetworkGatewayList.cs | 36 + ...kloadNetworkPortMirroring.Serialization.cs | 150 + .../Models/WorkloadNetworkPortMirroring.cs | 58 + ...dNetworkPortMirroringList.Serialization.cs | 46 + .../WorkloadNetworkPortMirroringList.cs | 36 + ...adNetworkPortMirroringProvisioningState.cs | 60 + .../WorkloadNetworkPublicIP.Serialization.cs | 107 + .../Models/WorkloadNetworkPublicIP.cs | 46 + ...orkloadNetworkPublicIPProvisioningState.cs | 60 + ...kloadNetworkPublicIPsList.Serialization.cs | 46 + .../Models/WorkloadNetworkPublicIPsList.cs | 36 + ...orkloadNetworkSegmentData.Serialization.cs | 157 + ...loadNetworkSegmentPortVif.Serialization.cs | 29 + .../Models/WorkloadNetworkSegmentPortVif.cs | 28 + ...WorkloadNetworkSegmentProvisioningState.cs | 60 + ...kloadNetworkSegmentSubnet.Serialization.cs | 67 + .../Models/WorkloadNetworkSegmentSubnet.cs | 36 + ...rkloadNetworkSegmentsList.Serialization.cs | 47 + .../Models/WorkloadNetworkSegmentsList.cs | 37 + .../WorkloadNetworkVMGroup.Serialization.cs | 139 + .../Models/WorkloadNetworkVMGroup.cs | 53 + ...WorkloadNetworkVMGroupProvisioningState.cs | 60 + ...rkloadNetworkVMGroupsList.Serialization.cs | 46 + .../Models/WorkloadNetworkVMGroupsList.cs | 36 + ...loadNetworkVirtualMachine.Serialization.cs | 85 + .../Models/WorkloadNetworkVirtualMachine.cs | 38 + ...etworkVirtualMachinesList.Serialization.cs | 46 + .../WorkloadNetworkVirtualMachinesList.cs | 36 + .../src/Generated/PlacementPolicy.cs | 245 + .../Generated/PlacementPolicyCollection.cs | 361 ++ .../src/Generated/PlacementPolicyData.cs | 35 + .../src/Generated/PrivateCloud.cs | 712 +++ .../src/Generated/PrivateCloudCollection.cs | 408 ++ .../src/Generated/PrivateCloudData.cs | 128 + .../RestOperations/AddonsRestOperations.cs | 512 ++ .../AuthorizationsRestOperations.cs | 512 ++ .../CloudLinksRestOperations.cs | 512 ++ .../RestOperations/ClustersRestOperations.cs | 614 +++ .../DatastoresRestOperations.cs | 570 +++ .../GlobalReachConnectionsRestOperations.cs | 512 ++ .../HcxEnterpriseSitesRestOperations.cs | 520 ++ .../RestOperations/LocationsRestOperations.cs | 193 + .../PlacementPoliciesRestOperations.cs | 684 +++ .../PrivateCloudsRestOperations.cs | 908 ++++ .../ScriptCmdletsRestOperations.cs | 350 ++ .../ScriptExecutionsRestOperations.cs | 628 +++ .../ScriptPackagesRestOperations.cs | 316 ++ .../VirtualMachinesRestOperations.cs | 463 ++ .../WorkloadNetworksRestOperations.cs | 4428 +++++++++++++++++ .../src/Generated/ScriptExecution.cs | 224 + .../Generated/ScriptExecutionCollection.cs | 361 ++ .../src/Generated/ScriptExecutionData.cs | 101 + .../src/Generated/WorkloadNetworkSegment.cs | 2042 ++++++++ .../WorkloadNetworkSegmentCollection.cs | 361 ++ .../Generated/WorkloadNetworkSegmentData.cs | 62 + 297 files changed, 36348 insertions(+) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Addon.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLink.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Cluster.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Datastore.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ResourceGroupExtensions.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionExtensions.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSite.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonCreateOrUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonDeleteOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationCreateOrUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationDeleteOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkCreateOrUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkDeleteOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterCreateOrUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterDeleteOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreCreateOrUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreDeleteOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionCreateOrUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionDeleteOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/HcxEnterpriseSiteCreateOrUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/HcxEnterpriseSiteDeleteOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyCreateOrUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyDeleteOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudCreateOrUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudDeleteOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudRotateNsxtPasswordOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudRotateVcenterPasswordOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionDeleteOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/VirtualMachineRestrictMovementOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDhcpOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsServiceOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsZoneOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePortMirroringOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePublicIPOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateVMGroupOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDhcpOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDnsServiceOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDnsZoneOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeletePortMirroringOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeletePublicIPOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteSegmentOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteVMGroupOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDhcpOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsServiceOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsZoneOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdatePortMirroringOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateVMGroupOperation.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonType.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AffinityType.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityStrategy.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkStatus.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterUpdate.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterUpdate.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreStatus.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DhcpTypeEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceLogLevelEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceStatusEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyStatus.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionVersionType.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionStatus.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteStatus.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/InternetEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/MountOptionEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/OptionalParamEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyType.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyUpdate.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyUpdate.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringStatusEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudIdentity.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudIdentity.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdate.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdate.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdateProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdateProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/QuotaEnabled.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceIdentityType.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterType.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptOutputStreamType.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameterTypes.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SegmentStatusEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Sku.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Sku.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SslEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/TrialStatus.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VMGroupStatusEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VMTypeEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovementState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VisibilityParameterEnum.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupProvisioningState.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicy.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Addon.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Addon.cs new file mode 100644 index 000000000000..b9e571e5e4d1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Addon.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a Addon along with the instance operations that can be performed on it. + public partial class Addon : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly AddonsRestOperations _restClient; + private readonly AddonData _data; + + /// Initializes a new instance of the class for mocking. + protected Addon() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal Addon(ArmResource options, AddonData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal Addon(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal Addon(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/addons"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual AddonData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get an addon by name in a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Addon.Get"); + scope.Start(); + try + { + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new Addon(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get an addon by name in a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Addon.Get"); + scope.Start(); + try + { + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new Addon(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Delete a addon in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Addon.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AddonDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a addon in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual AddonDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Addon.Delete"); + scope.Start(); + try + { + var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new AddonDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs new file mode 100644 index 000000000000..b4e6edc5bf1f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of Addon and their operations over a PrivateCloud. + public partial class AddonCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly AddonsRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected AddonCollection() + { + } + + /// Initializes a new instance of AddonCollection class. + /// The resource representing the parent resource. + internal AddonCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; + + // Collection level operations. + + /// Create or update a addon in a private cloud. + /// Name of the addon for the private cloud. + /// A addon in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual AddonCreateOrUpdateOperation CreateOrUpdate(string addonName, AddonData addon, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + if (addon == null) + { + throw new ArgumentNullException(nameof(addon)); + } + + using var scope = _clientDiagnostics.CreateScope("AddonCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, addonName, addon, cancellationToken); + var operation = new AddonCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, addonName, addon).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a addon in a private cloud. + /// Name of the addon for the private cloud. + /// A addon in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string addonName, AddonData addon, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + if (addon == null) + { + throw new ArgumentNullException(nameof(addon)); + } + + using var scope = _clientDiagnostics.CreateScope("AddonCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, addonName, addon, cancellationToken).ConfigureAwait(false); + var operation = new AddonCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, addonName, addon).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the addon for the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string addonName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("AddonCollection.Get"); + scope.Start(); + try + { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new Addon(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the addon for the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string addonName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("AddonCollection.Get"); + scope.Start(); + try + { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new Addon(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the addon for the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string addonName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("AddonCollection.GetIfExists"); + scope.Start(); + try + { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new Addon(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the addon for the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string addonName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("AddonCollection.GetIfExists"); + scope.Start(); + try + { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new Addon(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the addon for the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string addonName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("AddonCollection.CheckIfExists"); + scope.Start(); + try + { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + var response = GetIfExists(addonName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the addon for the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string addonName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("AddonCollection.CheckIfExists"); + scope.Start(); + try + { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + var response = await GetIfExistsAsync(addonName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List addons in a private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("AddonCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new Addon(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("AddonCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new Addon(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List addons in a private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("AddonCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new Addon(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("AddonCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new Addon(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs new file mode 100644 index 000000000000..a3d77985a008 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the Addon data model. + public partial class AddonData : Resource + { + /// Initializes a new instance of AddonData. + public AddonData() + { + } + + /// Initializes a new instance of AddonData. + /// The id. + /// The name. + /// The type. + /// The properties of an addon resource. + internal AddonData(ResourceIdentifier id, string name, ResourceType type, AddonProperties properties) : base(id, name, type) + { + Properties = properties; + } + + /// The properties of an addon resource. + public AddonProperties Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLink.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLink.cs new file mode 100644 index 000000000000..97c51b6543dd --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLink.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a CloudLink along with the instance operations that can be performed on it. + public partial class CloudLink : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly CloudLinksRestOperations _restClient; + private readonly CloudLinkData _data; + + /// Initializes a new instance of the class for mocking. + protected CloudLink() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal CloudLink(ArmResource options, CloudLinkData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal CloudLink(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal CloudLink(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/cloudLinks"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual CloudLinkData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get an cloud link by name in a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CloudLink.Get"); + scope.Start(); + try + { + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new CloudLink(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get an cloud link by name in a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CloudLink.Get"); + scope.Start(); + try + { + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CloudLink(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Delete a cloud link in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CloudLink.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new CloudLinkDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a cloud link in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual CloudLinkDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CloudLink.Delete"); + scope.Start(); + try + { + var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new CloudLinkDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs new file mode 100644 index 000000000000..140646bb1ab1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of CloudLink and their operations over a PrivateCloud. + public partial class CloudLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly CloudLinksRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected CloudLinkCollection() + { + } + + /// Initializes a new instance of CloudLinkCollection class. + /// The resource representing the parent resource. + internal CloudLinkCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; + + // Collection level operations. + + /// Create or update a cloud link in a private cloud. + /// Name of the cloud link resource. + /// A cloud link in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual CloudLinkCreateOrUpdateOperation CreateOrUpdate(string cloudLinkName, CloudLinkData cloudLink, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + if (cloudLink == null) + { + throw new ArgumentNullException(nameof(cloudLink)); + } + + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink, cancellationToken); + var operation = new CloudLinkCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a cloud link in a private cloud. + /// Name of the cloud link resource. + /// A cloud link in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string cloudLinkName, CloudLinkData cloudLink, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + if (cloudLink == null) + { + throw new ArgumentNullException(nameof(cloudLink)); + } + + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink, cancellationToken).ConfigureAwait(false); + var operation = new CloudLinkCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the cloud link resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string cloudLinkName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.Get"); + scope.Start(); + try + { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CloudLink(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the cloud link resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string cloudLinkName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.Get"); + scope.Start(); + try + { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new CloudLink(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the cloud link resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string cloudLinkName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.GetIfExists"); + scope.Start(); + try + { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new CloudLink(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the cloud link resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string cloudLinkName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.GetIfExists"); + scope.Start(); + try + { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new CloudLink(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the cloud link resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string cloudLinkName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.CheckIfExists"); + scope.Start(); + try + { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + var response = GetIfExists(cloudLinkName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the cloud link resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string cloudLinkName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.CheckIfExists"); + scope.Start(); + try + { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + var response = await GetIfExistsAsync(cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List cloud link in a private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new CloudLink(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new CloudLink(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List cloud link in a private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new CloudLink(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new CloudLink(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs new file mode 100644 index 000000000000..e585bbafc96f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the CloudLink data model. + public partial class CloudLinkData : Resource + { + /// Initializes a new instance of CloudLinkData. + public CloudLinkData() + { + } + + /// Initializes a new instance of CloudLinkData. + /// The id. + /// The name. + /// The type. + /// The state of the cloud link. + /// Identifier of the other private cloud participating in the link. + internal CloudLinkData(ResourceIdentifier id, string name, ResourceType type, CloudLinkStatus? status, string linkedCloud) : base(id, name, type) + { + Status = status; + LinkedCloud = linkedCloud; + } + + /// The state of the cloud link. + public CloudLinkStatus? Status { get; } + /// Identifier of the other private cloud participating in the link. + public string LinkedCloud { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Cluster.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Cluster.cs new file mode 100644 index 000000000000..a2cb79d41e0d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Cluster.cs @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a Cluster along with the instance operations that can be performed on it. + public partial class Cluster : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ClustersRestOperations _restClient; + private readonly ClusterData _data; + private VirtualMachinesRestOperations _virtualMachinesRestClient { get; } + + /// Initializes a new instance of the class for mocking. + protected Cluster() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal Cluster(ArmResource options, ClusterData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _virtualMachinesRestClient = new VirtualMachinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal Cluster(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _virtualMachinesRestClient = new VirtualMachinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal Cluster(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _virtualMachinesRestClient = new VirtualMachinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ClusterData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get a cluster by name in a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Cluster.Get"); + scope.Start(); + try + { + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new Cluster(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a cluster by name in a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Cluster.Get"); + scope.Start(); + try + { + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new Cluster(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Delete a cluster in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Cluster.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ClusterDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a cluster in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual ClusterDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Cluster.Delete"); + scope.Start(); + try + { + var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ClusterDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Get a virtual machine by id in a private cloud cluster. + /// The cancellation token to use. + public virtual async Task> GetVirtualMachineAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachine"); + scope.Start(); + try + { + var response = await _virtualMachinesRestClient.GetAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a virtual machine by id in a private cloud cluster. + /// The cancellation token to use. + public virtual Response GetVirtualMachine(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachine"); + scope.Start(); + try + { + var response = _virtualMachinesRestClient.Get(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of virtual machines in a private cloud cluster. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachines(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachines"); + scope.Start(); + try + { + var response = _virtualMachinesRestClient.GetAll(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachines"); + scope.Start(); + try + { + var response = _virtualMachinesRestClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of virtual machines in a private cloud cluster. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachinesAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachines"); + scope.Start(); + try + { + var response = await _virtualMachinesRestClient.GetAllAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachines"); + scope.Start(); + try + { + var response = await _virtualMachinesRestClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Update a cluster in a private cloud. + /// The cluster properties to be updated. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateAsync(ClusterUpdate clusterUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (clusterUpdate == null) + { + throw new ArgumentNullException(nameof(clusterUpdate)); + } + + using var scope = _clientDiagnostics.CreateScope("Cluster.Update"); + scope.Start(); + try + { + var response = await _restClient.UpdateAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate, cancellationToken).ConfigureAwait(false); + var operation = new ClusterUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update a cluster in a private cloud. + /// The cluster properties to be updated. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual ClusterUpdateOperation Update(ClusterUpdate clusterUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (clusterUpdate == null) + { + throw new ArgumentNullException(nameof(clusterUpdate)); + } + + using var scope = _clientDiagnostics.CreateScope("Cluster.Update"); + scope.Start(); + try + { + var response = _restClient.Update(Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate, cancellationToken); + var operation = new ClusterUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of Datastores in the Cluster. + /// An object representing collection of Datastores and their operations over a Cluster. + public DatastoreCollection GetDatastores() + { + return new DatastoreCollection(this); + } + + /// Gets a list of PlacementPolicies in the Cluster. + /// An object representing collection of PlacementPolicies and their operations over a Cluster. + public PlacementPolicyCollection GetPlacementPolicies() + { + return new PlacementPolicyCollection(this); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs new file mode 100644 index 000000000000..119b14162376 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of Cluster and their operations over a PrivateCloud. + public partial class ClusterCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ClustersRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected ClusterCollection() + { + } + + /// Initializes a new instance of ClusterCollection class. + /// The resource representing the parent resource. + internal ClusterCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; + + // Collection level operations. + + /// Create or update a cluster in a private cloud. + /// Name of the cluster in the private cloud. + /// A cluster in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual ClusterCreateOrUpdateOperation CreateOrUpdate(string clusterName, ClusterData cluster, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (cluster == null) + { + throw new ArgumentNullException(nameof(cluster)); + } + + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, clusterName, cluster, cancellationToken); + var operation = new ClusterCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, clusterName, cluster).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a cluster in a private cloud. + /// Name of the cluster in the private cloud. + /// A cluster in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string clusterName, ClusterData cluster, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (cluster == null) + { + throw new ArgumentNullException(nameof(cluster)); + } + + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, clusterName, cluster, cancellationToken).ConfigureAwait(false); + var operation = new ClusterCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, clusterName, cluster).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the cluster in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string clusterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.Get"); + scope.Start(); + try + { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new Cluster(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the cluster in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string clusterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.Get"); + scope.Start(); + try + { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new Cluster(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the cluster in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string clusterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.GetIfExists"); + scope.Start(); + try + { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new Cluster(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the cluster in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.GetIfExists"); + scope.Start(); + try + { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new Cluster(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the cluster in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string clusterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.CheckIfExists"); + scope.Start(); + try + { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + var response = GetIfExists(clusterName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the cluster in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.CheckIfExists"); + scope.Start(); + try + { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + var response = await GetIfExistsAsync(clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List clusters in a private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new Cluster(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new Cluster(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List clusters in a private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new Cluster(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new Cluster(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs new file mode 100644 index 000000000000..5ecb951a7731 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the Cluster data model. + public partial class ClusterData : Resource + { + /// Initializes a new instance of ClusterData. + /// The cluster SKU. + /// is null. + public ClusterData(Models.Sku sku) + { + if (sku == null) + { + throw new ArgumentNullException(nameof(sku)); + } + + Sku = sku; + Hosts = new ChangeTrackingList(); + } + + /// Initializes a new instance of ClusterData. + /// The id. + /// The name. + /// The type. + /// The cluster SKU. + /// The cluster size. + /// The state of the cluster provisioning. + /// The identity. + /// The hosts. + internal ClusterData(ResourceIdentifier id, string name, ResourceType type, Models.Sku sku, int? clusterSize, ClusterProvisioningState? provisioningState, int? clusterId, IList hosts) : base(id, name, type) + { + Sku = sku; + ClusterSize = clusterSize; + ProvisioningState = provisioningState; + ClusterId = clusterId; + Hosts = hosts; + } + + /// The cluster SKU. + public Models.Sku Sku { get; set; } + /// The cluster size. + public int? ClusterSize { get; set; } + /// The state of the cluster provisioning. + public ClusterProvisioningState? ProvisioningState { get; } + /// The identity. + public int? ClusterId { get; } + /// The hosts. + public IList Hosts { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Datastore.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Datastore.cs new file mode 100644 index 000000000000..d15d9e35023d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Datastore.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a Datastore along with the instance operations that can be performed on it. + public partial class Datastore : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly DatastoresRestOperations _restClient; + private readonly DatastoreData _data; + + /// Initializes a new instance of the class for mocking. + protected Datastore() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal Datastore(ArmResource options, DatastoreData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal Datastore(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal Datastore(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters/datastores"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DatastoreData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get a datastore in a private cloud cluster. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Datastore.Get"); + scope.Start(); + try + { + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new Datastore(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a datastore in a private cloud cluster. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Datastore.Get"); + scope.Start(); + try + { + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new Datastore(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Delete a datastore in a private cloud cluster. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Datastore.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatastoreDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a datastore in a private cloud cluster. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual DatastoreDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("Datastore.Delete"); + scope.Start(); + try + { + var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DatastoreDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs new file mode 100644 index 000000000000..9bbb9c58a101 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of Datastore and their operations over a Cluster. + public partial class DatastoreCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly DatastoresRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected DatastoreCollection() + { + } + + /// Initializes a new instance of DatastoreCollection class. + /// The resource representing the parent resource. + internal DatastoreCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => Cluster.ResourceType; + + // Collection level operations. + + /// Create or update a datastore in a private cloud cluster. + /// Name of the datastore in the private cloud cluster. + /// A datastore in a private cloud cluster. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual DatastoreCreateOrUpdateOperation CreateOrUpdate(string datastoreName, DatastoreData datastore, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + if (datastore == null) + { + throw new ArgumentNullException(nameof(datastore)); + } + + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore, cancellationToken); + var operation = new DatastoreCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a datastore in a private cloud cluster. + /// Name of the datastore in the private cloud cluster. + /// A datastore in a private cloud cluster. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string datastoreName, DatastoreData datastore, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + if (datastore == null) + { + throw new ArgumentNullException(nameof(datastore)); + } + + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore, cancellationToken).ConfigureAwait(false); + var operation = new DatastoreCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the datastore in the private cloud cluster. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string datastoreName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.Get"); + scope.Start(); + try + { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new Datastore(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the datastore in the private cloud cluster. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string datastoreName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.Get"); + scope.Start(); + try + { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new Datastore(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the datastore in the private cloud cluster. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string datastoreName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.GetIfExists"); + scope.Start(); + try + { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new Datastore(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the datastore in the private cloud cluster. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string datastoreName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.GetIfExists"); + scope.Start(); + try + { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new Datastore(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the datastore in the private cloud cluster. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string datastoreName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.CheckIfExists"); + scope.Start(); + try + { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + var response = GetIfExists(datastoreName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the datastore in the private cloud cluster. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string datastoreName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.CheckIfExists"); + scope.Start(); + try + { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + var response = await GetIfExistsAsync(datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List datastores in a private cloud cluster. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAll(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new Datastore(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new Datastore(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List datastores in a private cloud cluster. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new Datastore(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new Datastore(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs new file mode 100644 index 000000000000..784b4a5c8f5a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the Datastore data model. + public partial class DatastoreData : Resource + { + /// Initializes a new instance of DatastoreData. + public DatastoreData() + { + } + + /// Initializes a new instance of DatastoreData. + /// The id. + /// The name. + /// The type. + /// The state of the datastore provisioning. + /// An Azure NetApp Files volume. + /// An iSCSI volume. + /// The operational status of the datastore. + internal DatastoreData(ResourceIdentifier id, string name, ResourceType type, DatastoreProvisioningState? provisioningState, WritableSubResource netAppVolume, DiskPoolVolume diskPoolVolume, DatastoreStatus? status) : base(id, name, type) + { + ProvisioningState = provisioningState; + NetAppVolume = netAppVolume; + DiskPoolVolume = diskPoolVolume; + Status = status; + } + + /// The state of the datastore provisioning. + public DatastoreProvisioningState? ProvisioningState { get; } + /// An Azure NetApp Files volume. + public WritableSubResource NetAppVolume { get; set; } + /// An iSCSI volume. + public DiskPoolVolume DiskPoolVolume { get; set; } + /// The operational status of the datastore. + public DatastoreStatus? Status { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorization.cs new file mode 100644 index 000000000000..02431c803d1d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a ExpressRouteAuthorization along with the instance operations that can be performed on it. + public partial class ExpressRouteAuthorization : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly AuthorizationsRestOperations _restClient; + private readonly ExpressRouteAuthorizationData _data; + + /// Initializes a new instance of the class for mocking. + protected ExpressRouteAuthorization() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ExpressRouteAuthorization(ArmResource options, ExpressRouteAuthorizationData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ExpressRouteAuthorization(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal ExpressRouteAuthorization(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/authorizations"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ExpressRouteAuthorizationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get an ExpressRoute Circuit Authorization by name in a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorization.Get"); + scope.Start(); + try + { + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ExpressRouteAuthorization(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get an ExpressRoute Circuit Authorization by name in a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorization.Get"); + scope.Start(); + try + { + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteAuthorization(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Delete an ExpressRoute Circuit Authorization in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorization.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AuthorizationDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete an ExpressRoute Circuit Authorization in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual AuthorizationDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorization.Delete"); + scope.Start(); + try + { + var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new AuthorizationDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs new file mode 100644 index 000000000000..d800e0566dbc --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of ExpressRouteAuthorization and their operations over a PrivateCloud. + public partial class ExpressRouteAuthorizationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly AuthorizationsRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected ExpressRouteAuthorizationCollection() + { + } + + /// Initializes a new instance of ExpressRouteAuthorizationCollection class. + /// The resource representing the parent resource. + internal ExpressRouteAuthorizationCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; + + // Collection level operations. + + /// Create or update an ExpressRoute Circuit Authorization in a private cloud. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// An ExpressRoute Circuit Authorization. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual AuthorizationCreateOrUpdateOperation CreateOrUpdate(string authorizationName, ExpressRouteAuthorizationData authorization, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + if (authorization == null) + { + throw new ArgumentNullException(nameof(authorization)); + } + + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, authorizationName, authorization, cancellationToken); + var operation = new AuthorizationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, authorizationName, authorization).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an ExpressRoute Circuit Authorization in a private cloud. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// An ExpressRoute Circuit Authorization. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string authorizationName, ExpressRouteAuthorizationData authorization, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + if (authorization == null) + { + throw new ArgumentNullException(nameof(authorization)); + } + + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, authorizationName, authorization, cancellationToken).ConfigureAwait(false); + var operation = new AuthorizationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, authorizationName, authorization).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string authorizationName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.Get"); + scope.Start(); + try + { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ExpressRouteAuthorization(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string authorizationName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.Get"); + scope.Start(); + try + { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ExpressRouteAuthorization(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string authorizationName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.GetIfExists"); + scope.Start(); + try + { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new ExpressRouteAuthorization(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string authorizationName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.GetIfExists"); + scope.Start(); + try + { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new ExpressRouteAuthorization(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string authorizationName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.CheckIfExists"); + scope.Start(); + try + { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + var response = GetIfExists(authorizationName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string authorizationName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.CheckIfExists"); + scope.Start(); + try + { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + var response = await GetIfExistsAsync(authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List ExpressRoute Circuit Authorizations in a private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ExpressRouteAuthorization(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ExpressRouteAuthorization(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List ExpressRoute Circuit Authorizations in a private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ExpressRouteAuthorization(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ExpressRouteAuthorization(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs new file mode 100644 index 000000000000..255fe42f59ef --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the ExpressRouteAuthorization data model. + public partial class ExpressRouteAuthorizationData : Resource + { + /// Initializes a new instance of ExpressRouteAuthorizationData. + public ExpressRouteAuthorizationData() + { + } + + /// Initializes a new instance of ExpressRouteAuthorizationData. + /// The id. + /// The name. + /// The type. + /// The state of the ExpressRoute Circuit Authorization provisioning. + /// The ID of the ExpressRoute Circuit Authorization. + /// The key of the ExpressRoute Circuit Authorization. + /// The ID of the ExpressRoute Circuit. + internal ExpressRouteAuthorizationData(ResourceIdentifier id, string name, ResourceType type, ExpressRouteAuthorizationProvisioningState? provisioningState, string expressRouteAuthorizationId, string expressRouteAuthorizationKey, string expressRouteId) : base(id, name, type) + { + ProvisioningState = provisioningState; + ExpressRouteAuthorizationId = expressRouteAuthorizationId; + ExpressRouteAuthorizationKey = expressRouteAuthorizationKey; + ExpressRouteId = expressRouteId; + } + + /// The state of the ExpressRoute Circuit Authorization provisioning. + public ExpressRouteAuthorizationProvisioningState? ProvisioningState { get; } + /// The ID of the ExpressRoute Circuit Authorization. + public string ExpressRouteAuthorizationId { get; } + /// The key of the ExpressRoute Circuit Authorization. + public string ExpressRouteAuthorizationKey { get; } + /// The ID of the ExpressRoute Circuit. + public string ExpressRouteId { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs new file mode 100644 index 000000000000..d760c98ec50a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs +{ + /// A class to add extension methods to ArmClient. + public static partial class ArmClientExtensions + { + #region PrivateCloud + /// Gets an object representing a PrivateCloud along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static PrivateCloud GetPrivateCloud(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new PrivateCloud(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region Cluster + /// Gets an object representing a Cluster along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static Cluster GetCluster(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new Cluster(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region Datastore + /// Gets an object representing a Datastore along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static Datastore GetDatastore(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new Datastore(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region HcxEnterpriseSite + /// Gets an object representing a HcxEnterpriseSite along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static HcxEnterpriseSite GetHcxEnterpriseSite(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new HcxEnterpriseSite(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region ExpressRouteAuthorization + /// Gets an object representing a ExpressRouteAuthorization along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ExpressRouteAuthorization GetExpressRouteAuthorization(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new ExpressRouteAuthorization(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region GlobalReachConnection + /// Gets an object representing a GlobalReachConnection along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static GlobalReachConnection GetGlobalReachConnection(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new GlobalReachConnection(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region WorkloadNetworkSegment + /// Gets an object representing a WorkloadNetworkSegment along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkloadNetworkSegment GetWorkloadNetworkSegment(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkSegment(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region CloudLink + /// Gets an object representing a CloudLink along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static CloudLink GetCloudLink(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new CloudLink(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region Addon + /// Gets an object representing a Addon along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static Addon GetAddon(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new Addon(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region PlacementPolicy + /// Gets an object representing a PlacementPolicy along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static PlacementPolicy GetPlacementPolicy(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new PlacementPolicy(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region ScriptExecution + /// Gets an object representing a ScriptExecution along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ScriptExecution GetScriptExecution(this ArmClient armClient, ResourceIdentifier id) + { + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new ScriptExecution(clientOptions, credential, uri, pipeline, id)); + } + #endregion + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ResourceGroupExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ResourceGroupExtensions.cs new file mode 100644 index 000000000000..96d078f1967f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ResourceGroupExtensions.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Avs +{ + /// A class to add extension methods to ResourceGroup. + public static partial class ResourceGroupExtensions + { + #region PrivateCloud + /// Gets an object representing a PrivateCloudCollection along with the instance operations that can be performed on it. + /// The instance the method will execute against. + /// Returns a object. + public static PrivateCloudCollection GetPrivateClouds(this ResourceGroup resourceGroup) + { + return new PrivateCloudCollection(resourceGroup); + } + #endregion + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionExtensions.cs new file mode 100644 index 000000000000..9204e557f648 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionExtensions.cs @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Avs +{ + /// A class to add extension methods to Subscription. + public static partial class SubscriptionExtensions + { + #region PrivateCloud + private static PrivateCloudsRestOperations GetPrivateCloudsRestOperations(ClientDiagnostics clientDiagnostics, TokenCredential credential, ArmClientOptions clientOptions, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + return new PrivateCloudsRestOperations(clientDiagnostics, pipeline, clientOptions, subscriptionId, endpoint); + } + + /// Lists the PrivateClouds for this . + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static AsyncPageable GetPrivateCloudsAsync(this Subscription subscription, CancellationToken cancellationToken = default) + { + return subscription.UseClientContext((baseUri, credential, options, pipeline) => + { + var clientDiagnostics = new ClientDiagnostics(options); + var restOperations = GetPrivateCloudsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetPrivateClouds"); + scope.Start(); + try + { + var response = await restOperations.GetInSubscriptionAsync(cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetPrivateClouds"); + scope.Start(); + try + { + var response = await restOperations.GetInSubscriptionNextPageAsync(nextLink, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + ); + } + + /// Lists the PrivateClouds for this . + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static Pageable GetPrivateClouds(this Subscription subscription, CancellationToken cancellationToken = default) + { + return subscription.UseClientContext((baseUri, credential, options, pipeline) => + { + var clientDiagnostics = new ClientDiagnostics(options); + var restOperations = GetPrivateCloudsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetPrivateClouds"); + scope.Start(); + try + { + var response = restOperations.GetInSubscription(cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetPrivateClouds"); + scope.Start(); + try + { + var response = restOperations.GetInSubscriptionNextPage(nextLink, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + ); + } + + /// Filters the list of PrivateClouds for a represented as generic resources. + /// The instance the method will execute against. + /// The string to filter the list. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. + /// The number of results to return. + /// The cancellation token to use. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static AsyncPageable GetPrivateCloudByNameAsync(this Subscription subscription, string filter, string expand, int? top, CancellationToken cancellationToken = default) + { + ResourceFilterCollection filters = new(PrivateCloud.ResourceType); + filters.SubstringFilter = filter; + return ResourceListOperations.GetAtContextAsync(subscription, filters, expand, top, cancellationToken); + } + + /// Filters the list of PrivateClouds for a represented as generic resources. + /// The instance the method will execute against. + /// The string to filter the list. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. + /// The number of results to return. + /// The cancellation token to use. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static Pageable GetPrivateCloudByName(this Subscription subscription, string filter, string expand, int? top, CancellationToken cancellationToken = default) + { + ResourceFilterCollection filters = new(PrivateCloud.ResourceType); + filters.SubstringFilter = filter; + return ResourceListOperations.GetAtContext(subscription, filters, expand, top, cancellationToken); + } + #endregion + + #region Location + private static LocationsRestOperations GetLocationsRestOperations(ClientDiagnostics clientDiagnostics, TokenCredential credential, ArmClientOptions clientOptions, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + { + return new LocationsRestOperations(clientDiagnostics, pipeline, clientOptions, subscriptionId, endpoint); + } + + /// Return trial status for subscription by region. + /// The instance the method will execute against. + /// Azure region. + /// The cancellation token to use. + /// is null. + public static async Task> CheckLocationTrialAvailabilityAsync(this Subscription subscription, string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + return await subscription.UseClientContext(async (baseUri, credential, options, pipeline) => + { + var clientDiagnostics = new ClientDiagnostics(options); + var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckLocationTrialAvailability"); + scope.Start(); + try + { + var response = await restOperations.CheckTrialAvailabilityAsync(location, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + ).ConfigureAwait(false); + } + + /// Return trial status for subscription by region. + /// The instance the method will execute against. + /// Azure region. + /// The cancellation token to use. + /// is null. + public static Response CheckLocationTrialAvailability(this Subscription subscription, string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + return subscription.UseClientContext((baseUri, credential, options, pipeline) => + { + var clientDiagnostics = new ClientDiagnostics(options); + var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckLocationTrialAvailability"); + scope.Start(); + try + { + var response = restOperations.CheckTrialAvailability(location, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + ); + } + + /// Return quota for subscription by region. + /// The instance the method will execute against. + /// Azure region. + /// The cancellation token to use. + /// is null. + public static async Task> CheckLocationQuotaAvailabilityAsync(this Subscription subscription, string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + return await subscription.UseClientContext(async (baseUri, credential, options, pipeline) => + { + var clientDiagnostics = new ClientDiagnostics(options); + var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckLocationQuotaAvailability"); + scope.Start(); + try + { + var response = await restOperations.CheckQuotaAvailabilityAsync(location, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + ).ConfigureAwait(false); + } + + /// Return quota for subscription by region. + /// The instance the method will execute against. + /// Azure region. + /// The cancellation token to use. + /// is null. + public static Response CheckLocationQuotaAvailability(this Subscription subscription, string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + return subscription.UseClientContext((baseUri, credential, options, pipeline) => + { + var clientDiagnostics = new ClientDiagnostics(options); + var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckLocationQuotaAvailability"); + scope.Start(); + try + { + var response = restOperations.CheckQuotaAvailability(location, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + ); + } + + #endregion + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnection.cs new file mode 100644 index 000000000000..9c9752ba2e63 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnection.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a GlobalReachConnection along with the instance operations that can be performed on it. + public partial class GlobalReachConnection : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly GlobalReachConnectionsRestOperations _restClient; + private readonly GlobalReachConnectionData _data; + + /// Initializes a new instance of the class for mocking. + protected GlobalReachConnection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal GlobalReachConnection(ArmResource options, GlobalReachConnectionData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal GlobalReachConnection(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal GlobalReachConnection(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/globalReachConnections"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual GlobalReachConnectionData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get a global reach connection by name in a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnection.Get"); + scope.Start(); + try + { + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new GlobalReachConnection(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a global reach connection by name in a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnection.Get"); + scope.Start(); + try + { + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GlobalReachConnection(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Delete a global reach connection in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnection.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new GlobalReachConnectionDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a global reach connection in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual GlobalReachConnectionDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnection.Delete"); + scope.Start(); + try + { + var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new GlobalReachConnectionDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs new file mode 100644 index 000000000000..6f0fe6841108 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of GlobalReachConnection and their operations over a PrivateCloud. + public partial class GlobalReachConnectionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly GlobalReachConnectionsRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected GlobalReachConnectionCollection() + { + } + + /// Initializes a new instance of GlobalReachConnectionCollection class. + /// The resource representing the parent resource. + internal GlobalReachConnectionCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; + + // Collection level operations. + + /// Create or update a global reach connection in a private cloud. + /// Name of the global reach connection in the private cloud. + /// A global reach connection in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual GlobalReachConnectionCreateOrUpdateOperation CreateOrUpdate(string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + if (globalReachConnection == null) + { + throw new ArgumentNullException(nameof(globalReachConnection)); + } + + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection, cancellationToken); + var operation = new GlobalReachConnectionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a global reach connection in a private cloud. + /// Name of the global reach connection in the private cloud. + /// A global reach connection in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + if (globalReachConnection == null) + { + throw new ArgumentNullException(nameof(globalReachConnection)); + } + + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection, cancellationToken).ConfigureAwait(false); + var operation = new GlobalReachConnectionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the global reach connection in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string globalReachConnectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.Get"); + scope.Start(); + try + { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GlobalReachConnection(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the global reach connection in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string globalReachConnectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.Get"); + scope.Start(); + try + { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new GlobalReachConnection(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the global reach connection in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string globalReachConnectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.GetIfExists"); + scope.Start(); + try + { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new GlobalReachConnection(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the global reach connection in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string globalReachConnectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.GetIfExists"); + scope.Start(); + try + { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new GlobalReachConnection(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the global reach connection in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string globalReachConnectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.CheckIfExists"); + scope.Start(); + try + { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + var response = GetIfExists(globalReachConnectionName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the global reach connection in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string globalReachConnectionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.CheckIfExists"); + scope.Start(); + try + { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + var response = await GetIfExistsAsync(globalReachConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List global reach connections in a private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new GlobalReachConnection(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new GlobalReachConnection(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List global reach connections in a private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new GlobalReachConnection(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new GlobalReachConnection(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs new file mode 100644 index 000000000000..cb44de722432 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the GlobalReachConnection data model. + public partial class GlobalReachConnectionData : Resource + { + /// Initializes a new instance of GlobalReachConnectionData. + public GlobalReachConnectionData() + { + } + + /// Initializes a new instance of GlobalReachConnectionData. + /// The id. + /// The name. + /// The type. + /// The state of the ExpressRoute Circuit Authorization provisioning. + /// The network used for global reach carved out from the original network block provided for the private cloud. + /// Authorization key from the peer express route used for the global reach connection. + /// The connection status of the global reach connection. + /// Identifier of the ExpressRoute Circuit to peer with in the global reach connection. + /// The ID of the Private Cloud's ExpressRoute Circuit that is participating in the global reach connection. + internal GlobalReachConnectionData(ResourceIdentifier id, string name, ResourceType type, GlobalReachConnectionProvisioningState? provisioningState, string addressPrefix, string authorizationKey, GlobalReachConnectionStatus? circuitConnectionStatus, string peerExpressRouteCircuit, string expressRouteId) : base(id, name, type) + { + ProvisioningState = provisioningState; + AddressPrefix = addressPrefix; + AuthorizationKey = authorizationKey; + CircuitConnectionStatus = circuitConnectionStatus; + PeerExpressRouteCircuit = peerExpressRouteCircuit; + ExpressRouteId = expressRouteId; + } + + /// The state of the ExpressRoute Circuit Authorization provisioning. + public GlobalReachConnectionProvisioningState? ProvisioningState { get; } + /// The network used for global reach carved out from the original network block provided for the private cloud. + public string AddressPrefix { get; } + /// Authorization key from the peer express route used for the global reach connection. + public string AuthorizationKey { get; set; } + /// The connection status of the global reach connection. + public GlobalReachConnectionStatus? CircuitConnectionStatus { get; } + /// Identifier of the ExpressRoute Circuit to peer with in the global reach connection. + public string PeerExpressRouteCircuit { get; set; } + /// The ID of the Private Cloud's ExpressRoute Circuit that is participating in the global reach connection. + public string ExpressRouteId { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSite.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSite.cs new file mode 100644 index 000000000000..e63fc9af281e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSite.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a HcxEnterpriseSite along with the instance operations that can be performed on it. + public partial class HcxEnterpriseSite : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HcxEnterpriseSitesRestOperations _restClient; + private readonly HcxEnterpriseSiteData _data; + + /// Initializes a new instance of the class for mocking. + protected HcxEnterpriseSite() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal HcxEnterpriseSite(ArmResource options, HcxEnterpriseSiteData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal HcxEnterpriseSite(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal HcxEnterpriseSite(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/hcxEnterpriseSites"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual HcxEnterpriseSiteData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get an HCX Enterprise Site by name in a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSite.Get"); + scope.Start(); + try + { + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new HcxEnterpriseSite(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get an HCX Enterprise Site by name in a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSite.Get"); + scope.Start(); + try + { + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new HcxEnterpriseSite(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Delete an HCX Enterprise Site in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSite.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new HcxEnterpriseSiteDeleteOperation(response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete an HCX Enterprise Site in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual HcxEnterpriseSiteDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSite.Delete"); + scope.Start(); + try + { + var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new HcxEnterpriseSiteDeleteOperation(response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs new file mode 100644 index 000000000000..30ebffeb49b1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of HcxEnterpriseSite and their operations over a PrivateCloud. + public partial class HcxEnterpriseSiteCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly HcxEnterpriseSitesRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected HcxEnterpriseSiteCollection() + { + } + + /// Initializes a new instance of HcxEnterpriseSiteCollection class. + /// The resource representing the parent resource. + internal HcxEnterpriseSiteCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; + + // Collection level operations. + + /// Create or update an HCX Enterprise Site in a private cloud. + /// Name of the HCX Enterprise Site in the private cloud. + /// The HCX Enterprise Site. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual HcxEnterpriseSiteCreateOrUpdateOperation CreateOrUpdate(string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + if (hcxEnterpriseSite == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSite)); + } + + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, hcxEnterpriseSite, cancellationToken); + var operation = new HcxEnterpriseSiteCreateOrUpdateOperation(Parent, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update an HCX Enterprise Site in a private cloud. + /// Name of the HCX Enterprise Site in the private cloud. + /// The HCX Enterprise Site. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + if (hcxEnterpriseSite == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSite)); + } + + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, hcxEnterpriseSite, cancellationToken).ConfigureAwait(false); + var operation = new HcxEnterpriseSiteCreateOrUpdateOperation(Parent, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the HCX Enterprise Site in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.Get"); + scope.Start(); + try + { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new HcxEnterpriseSite(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the HCX Enterprise Site in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.Get"); + scope.Start(); + try + { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new HcxEnterpriseSite(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the HCX Enterprise Site in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.GetIfExists"); + scope.Start(); + try + { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new HcxEnterpriseSite(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the HCX Enterprise Site in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.GetIfExists"); + scope.Start(); + try + { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new HcxEnterpriseSite(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the HCX Enterprise Site in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.CheckIfExists"); + scope.Start(); + try + { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + var response = GetIfExists(hcxEnterpriseSiteName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the HCX Enterprise Site in the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.CheckIfExists"); + scope.Start(); + try + { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + var response = await GetIfExistsAsync(hcxEnterpriseSiteName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List HCX Enterprise Sites in a private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new HcxEnterpriseSite(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new HcxEnterpriseSite(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List HCX Enterprise Sites in a private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new HcxEnterpriseSite(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new HcxEnterpriseSite(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs new file mode 100644 index 000000000000..cfa1a42bd07b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the HcxEnterpriseSite data model. + public partial class HcxEnterpriseSiteData : Resource + { + /// Initializes a new instance of HcxEnterpriseSiteData. + public HcxEnterpriseSiteData() + { + } + + /// Initializes a new instance of HcxEnterpriseSiteData. + /// The id. + /// The name. + /// The type. + /// The activation key. + /// The status of the HCX Enterprise Site. + internal HcxEnterpriseSiteData(ResourceIdentifier id, string name, ResourceType type, string activationKey, HcxEnterpriseSiteStatus? status) : base(id, name, type) + { + ActivationKey = activationKey; + Status = status; + } + + /// The activation key. + public string ActivationKey { get; } + /// The status of the HCX Enterprise Site. + public HcxEnterpriseSiteStatus? Status { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..14e7752e52af --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonCreateOrUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a addon in a private cloud. + public partial class AddonCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of AddonCreateOrUpdateOperation for mocking. + protected AddonCreateOrUpdateOperation() + { + } + + internal AddonCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "AddonCreateOrUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override Addon Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Addon IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new Addon(_operationBase, AddonData.DeserializeAddonData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new Addon(_operationBase, AddonData.DeserializeAddonData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonDeleteOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonDeleteOperation.cs new file mode 100644 index 000000000000..50d6b3cea585 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a addon in a private cloud. + public partial class AddonDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of AddonDeleteOperation for mocking. + protected AddonDeleteOperation() + { + } + + internal AddonDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "AddonDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..ce2fc6330a0e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationCreateOrUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update an ExpressRoute Circuit Authorization in a private cloud. + public partial class AuthorizationCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of AuthorizationCreateOrUpdateOperation for mocking. + protected AuthorizationCreateOrUpdateOperation() + { + } + + internal AuthorizationCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "AuthorizationCreateOrUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override ExpressRouteAuthorization Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ExpressRouteAuthorization IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new ExpressRouteAuthorization(_operationBase, ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new ExpressRouteAuthorization(_operationBase, ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationDeleteOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationDeleteOperation.cs new file mode 100644 index 000000000000..1d52cf439ee0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete an ExpressRoute Circuit Authorization in a private cloud. + public partial class AuthorizationDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of AuthorizationDeleteOperation for mocking. + protected AuthorizationDeleteOperation() + { + } + + internal AuthorizationDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "AuthorizationDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..e91bc96e108f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkCreateOrUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a cloud link in a private cloud. + public partial class CloudLinkCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of CloudLinkCreateOrUpdateOperation for mocking. + protected CloudLinkCreateOrUpdateOperation() + { + } + + internal CloudLinkCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CloudLinkCreateOrUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override CloudLink Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + CloudLink IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new CloudLink(_operationBase, CloudLinkData.DeserializeCloudLinkData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new CloudLink(_operationBase, CloudLinkData.DeserializeCloudLinkData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkDeleteOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkDeleteOperation.cs new file mode 100644 index 000000000000..fafdbcaf908c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a cloud link in a private cloud. + public partial class CloudLinkDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of CloudLinkDeleteOperation for mocking. + protected CloudLinkDeleteOperation() + { + } + + internal CloudLinkDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "CloudLinkDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..c048ff7e54f1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterCreateOrUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a cluster in a private cloud. + public partial class ClusterCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of ClusterCreateOrUpdateOperation for mocking. + protected ClusterCreateOrUpdateOperation() + { + } + + internal ClusterCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ClusterCreateOrUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override Cluster Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Cluster IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new Cluster(_operationBase, ClusterData.DeserializeClusterData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new Cluster(_operationBase, ClusterData.DeserializeClusterData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterDeleteOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterDeleteOperation.cs new file mode 100644 index 000000000000..3771a013e8a9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a cluster in a private cloud. + public partial class ClusterDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of ClusterDeleteOperation for mocking. + protected ClusterDeleteOperation() + { + } + + internal ClusterDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ClusterDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterUpdateOperation.cs new file mode 100644 index 000000000000..a751b9b677cb --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Update a cluster in a private cloud. + public partial class ClusterUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of ClusterUpdateOperation for mocking. + protected ClusterUpdateOperation() + { + } + + internal ClusterUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ClusterUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override Cluster Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Cluster IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new Cluster(_operationBase, ClusterData.DeserializeClusterData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new Cluster(_operationBase, ClusterData.DeserializeClusterData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..cea585c6868b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreCreateOrUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a datastore in a private cloud cluster. + public partial class DatastoreCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of DatastoreCreateOrUpdateOperation for mocking. + protected DatastoreCreateOrUpdateOperation() + { + } + + internal DatastoreCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatastoreCreateOrUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override Datastore Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + Datastore IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new Datastore(_operationBase, DatastoreData.DeserializeDatastoreData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new Datastore(_operationBase, DatastoreData.DeserializeDatastoreData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreDeleteOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreDeleteOperation.cs new file mode 100644 index 000000000000..df96b704861c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a datastore in a private cloud cluster. + public partial class DatastoreDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of DatastoreDeleteOperation for mocking. + protected DatastoreDeleteOperation() + { + } + + internal DatastoreDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DatastoreDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..dfe4f8c47401 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionCreateOrUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a global reach connection in a private cloud. + public partial class GlobalReachConnectionCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of GlobalReachConnectionCreateOrUpdateOperation for mocking. + protected GlobalReachConnectionCreateOrUpdateOperation() + { + } + + internal GlobalReachConnectionCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GlobalReachConnectionCreateOrUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override GlobalReachConnection Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + GlobalReachConnection IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new GlobalReachConnection(_operationBase, GlobalReachConnectionData.DeserializeGlobalReachConnectionData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new GlobalReachConnection(_operationBase, GlobalReachConnectionData.DeserializeGlobalReachConnectionData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionDeleteOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionDeleteOperation.cs new file mode 100644 index 000000000000..d560da4783ed --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a global reach connection in a private cloud. + public partial class GlobalReachConnectionDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of GlobalReachConnectionDeleteOperation for mocking. + protected GlobalReachConnectionDeleteOperation() + { + } + + internal GlobalReachConnectionDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "GlobalReachConnectionDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/HcxEnterpriseSiteCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/HcxEnterpriseSiteCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..c63f37bd9b26 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/HcxEnterpriseSiteCreateOrUpdateOperation.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update an HCX Enterprise Site in a private cloud. + public partial class HcxEnterpriseSiteCreateOrUpdateOperation : Operation + { + private readonly OperationOrResponseInternals _operation; + + /// Initializes a new instance of HcxEnterpriseSiteCreateOrUpdateOperation for mocking. + protected HcxEnterpriseSiteCreateOrUpdateOperation() + { + } + + internal HcxEnterpriseSiteCreateOrUpdateOperation(ArmResource operationsBase, Response response) + { + _operation = new OperationOrResponseInternals(Response.FromValue(new HcxEnterpriseSite(operationsBase, response.Value), response.GetRawResponse())); + } + + /// + public override string Id => _operation.Id; + + /// + public override HcxEnterpriseSite Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/HcxEnterpriseSiteDeleteOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/HcxEnterpriseSiteDeleteOperation.cs new file mode 100644 index 000000000000..9b627e41a195 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/HcxEnterpriseSiteDeleteOperation.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete an HCX Enterprise Site in a private cloud. + public partial class HcxEnterpriseSiteDeleteOperation : Operation + { + private readonly OperationOrResponseInternals _operation; + + /// Initializes a new instance of HcxEnterpriseSiteDeleteOperation for mocking. + protected HcxEnterpriseSiteDeleteOperation() + { + } + + internal HcxEnterpriseSiteDeleteOperation(Response response) + { + _operation = new OperationOrResponseInternals(response); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..6bed6e39fd1c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyCreateOrUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a placement policy in a private cloud cluster. + public partial class PlacementPolicyCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of PlacementPolicyCreateOrUpdateOperation for mocking. + protected PlacementPolicyCreateOrUpdateOperation() + { + } + + internal PlacementPolicyCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PlacementPolicyCreateOrUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override PlacementPolicy Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + PlacementPolicy IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new PlacementPolicy(_operationBase, PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new PlacementPolicy(_operationBase, PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyDeleteOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyDeleteOperation.cs new file mode 100644 index 000000000000..7a58d4beaf30 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a placement policy in a private cloud cluster. + public partial class PlacementPolicyDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of PlacementPolicyDeleteOperation for mocking. + protected PlacementPolicyDeleteOperation() + { + } + + internal PlacementPolicyDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PlacementPolicyDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyUpdateOperation.cs new file mode 100644 index 000000000000..f34a227c9089 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Update a placement policy in a private cloud cluster. + public partial class PlacementPolicyUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of PlacementPolicyUpdateOperation for mocking. + protected PlacementPolicyUpdateOperation() + { + } + + internal PlacementPolicyUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PlacementPolicyUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override PlacementPolicy Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + PlacementPolicy IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new PlacementPolicy(_operationBase, PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new PlacementPolicy(_operationBase, PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..e38eb586d1c9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudCreateOrUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a private cloud. + public partial class PrivateCloudCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of PrivateCloudCreateOrUpdateOperation for mocking. + protected PrivateCloudCreateOrUpdateOperation() + { + } + + internal PrivateCloudCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PrivateCloudCreateOrUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override PrivateCloud Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + PrivateCloud IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new PrivateCloud(_operationBase, PrivateCloudData.DeserializePrivateCloudData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new PrivateCloud(_operationBase, PrivateCloudData.DeserializePrivateCloudData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudDeleteOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudDeleteOperation.cs new file mode 100644 index 000000000000..b5d62cd9774d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a private cloud. + public partial class PrivateCloudDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of PrivateCloudDeleteOperation for mocking. + protected PrivateCloudDeleteOperation() + { + } + + internal PrivateCloudDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PrivateCloudDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudRotateNsxtPasswordOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudRotateNsxtPasswordOperation.cs new file mode 100644 index 000000000000..70a45e2b38b1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudRotateNsxtPasswordOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Rotate the NSX-T Manager password. + public partial class PrivateCloudRotateNsxtPasswordOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of PrivateCloudRotateNsxtPasswordOperation for mocking. + protected PrivateCloudRotateNsxtPasswordOperation() + { + } + + internal PrivateCloudRotateNsxtPasswordOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PrivateCloudRotateNsxtPasswordOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudRotateVcenterPasswordOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudRotateVcenterPasswordOperation.cs new file mode 100644 index 000000000000..ad2ff9289638 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudRotateVcenterPasswordOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Rotate the vCenter password. + public partial class PrivateCloudRotateVcenterPasswordOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of PrivateCloudRotateVcenterPasswordOperation for mocking. + protected PrivateCloudRotateVcenterPasswordOperation() + { + } + + internal PrivateCloudRotateVcenterPasswordOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PrivateCloudRotateVcenterPasswordOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudUpdateOperation.cs new file mode 100644 index 000000000000..df738e73f08e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Update a private cloud. + public partial class PrivateCloudUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of PrivateCloudUpdateOperation for mocking. + protected PrivateCloudUpdateOperation() + { + } + + internal PrivateCloudUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "PrivateCloudUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override PrivateCloud Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + PrivateCloud IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new PrivateCloud(_operationBase, PrivateCloudData.DeserializePrivateCloudData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new PrivateCloud(_operationBase, PrivateCloudData.DeserializePrivateCloudData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs new file mode 100644 index 000000000000..f801b5990d0c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a script execution in a private cloud. + public partial class ScriptExecutionCreateOrUpdateOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of ScriptExecutionCreateOrUpdateOperation for mocking. + protected ScriptExecutionCreateOrUpdateOperation() + { + } + + internal ScriptExecutionCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ScriptExecutionCreateOrUpdateOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override ScriptExecution Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + ScriptExecution IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new ScriptExecution(_operationBase, ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new ScriptExecution(_operationBase, ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionDeleteOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionDeleteOperation.cs new file mode 100644 index 000000000000..a5c616834daa --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionDeleteOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Cancel a ScriptExecution in a private cloud. + public partial class ScriptExecutionDeleteOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of ScriptExecutionDeleteOperation for mocking. + protected ScriptExecutionDeleteOperation() + { + } + + internal ScriptExecutionDeleteOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ScriptExecutionDeleteOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/VirtualMachineRestrictMovementOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/VirtualMachineRestrictMovementOperation.cs new file mode 100644 index 000000000000..0ba4ccd8e284 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/VirtualMachineRestrictMovementOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Enable or disable DRS-driven VM movement restriction. + public partial class VirtualMachineRestrictMovementOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of VirtualMachineRestrictMovementOperation for mocking. + protected VirtualMachineRestrictMovementOperation() + { + } + + internal VirtualMachineRestrictMovementOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "VirtualMachineRestrictMovementOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDhcpOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDhcpOperation.cs new file mode 100644 index 000000000000..74a379614d67 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDhcpOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create dhcp by id in a private cloud workload network. + public partial class WorkloadNetworkCreateDhcpOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkCreateDhcpOperation for mocking. + protected WorkloadNetworkCreateDhcpOperation() + { + } + + internal WorkloadNetworkCreateDhcpOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateDhcpOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkDhcp Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkDhcp IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsServiceOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsServiceOperation.cs new file mode 100644 index 000000000000..cc1fa23dfcb7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsServiceOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create a DNS service by id in a private cloud workload network. + public partial class WorkloadNetworkCreateDnsServiceOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkCreateDnsServiceOperation for mocking. + protected WorkloadNetworkCreateDnsServiceOperation() + { + } + + internal WorkloadNetworkCreateDnsServiceOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateDnsServiceOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkDnsService Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkDnsService IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsZoneOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsZoneOperation.cs new file mode 100644 index 000000000000..aa4b144cd9f8 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsZoneOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create a DNS zone by id in a private cloud workload network. + public partial class WorkloadNetworkCreateDnsZoneOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkCreateDnsZoneOperation for mocking. + protected WorkloadNetworkCreateDnsZoneOperation() + { + } + + internal WorkloadNetworkCreateDnsZoneOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateDnsZoneOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkDnsZone Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkDnsZone IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePortMirroringOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePortMirroringOperation.cs new file mode 100644 index 000000000000..9212892cbdcc --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePortMirroringOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create a port mirroring profile by id in a private cloud workload network. + public partial class WorkloadNetworkCreatePortMirroringOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkCreatePortMirroringOperation for mocking. + protected WorkloadNetworkCreatePortMirroringOperation() + { + } + + internal WorkloadNetworkCreatePortMirroringOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreatePortMirroringOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkPortMirroring Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkPortMirroring IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePublicIPOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePublicIPOperation.cs new file mode 100644 index 000000000000..1fe7d7b5d192 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePublicIPOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create a Public IP Block by id in a private cloud workload network. + public partial class WorkloadNetworkCreatePublicIPOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkCreatePublicIPOperation for mocking. + protected WorkloadNetworkCreatePublicIPOperation() + { + } + + internal WorkloadNetworkCreatePublicIPOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreatePublicIPOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkPublicIP Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkPublicIP IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs new file mode 100644 index 000000000000..dab68e2e0f96 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create a segment by id in a private cloud workload network. + public partial class WorkloadNetworkCreateSegmentsOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of WorkloadNetworkCreateSegmentsOperation for mocking. + protected WorkloadNetworkCreateSegmentsOperation() + { + } + + internal WorkloadNetworkCreateSegmentsOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateSegmentsOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkSegment Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkSegment IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new WorkloadNetworkSegment(_operationBase, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new WorkloadNetworkSegment(_operationBase, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateVMGroupOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateVMGroupOperation.cs new file mode 100644 index 000000000000..614da0d892be --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateVMGroupOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create a vm group by id in a private cloud workload network. + public partial class WorkloadNetworkCreateVMGroupOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkCreateVMGroupOperation for mocking. + protected WorkloadNetworkCreateVMGroupOperation() + { + } + + internal WorkloadNetworkCreateVMGroupOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateVMGroupOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkVMGroup Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkVMGroup IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDhcpOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDhcpOperation.cs new file mode 100644 index 000000000000..409848b1dc3e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDhcpOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete dhcp by id in a private cloud workload network. + public partial class WorkloadNetworkDeleteDhcpOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkDeleteDhcpOperation for mocking. + protected WorkloadNetworkDeleteDhcpOperation() + { + } + + internal WorkloadNetworkDeleteDhcpOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkDeleteDhcpOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDnsServiceOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDnsServiceOperation.cs new file mode 100644 index 000000000000..93646e19713f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDnsServiceOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a DNS service by id in a private cloud workload network. + public partial class WorkloadNetworkDeleteDnsServiceOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkDeleteDnsServiceOperation for mocking. + protected WorkloadNetworkDeleteDnsServiceOperation() + { + } + + internal WorkloadNetworkDeleteDnsServiceOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkDeleteDnsServiceOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDnsZoneOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDnsZoneOperation.cs new file mode 100644 index 000000000000..0a2f35a9e71b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteDnsZoneOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a DNS zone by id in a private cloud workload network. + public partial class WorkloadNetworkDeleteDnsZoneOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkDeleteDnsZoneOperation for mocking. + protected WorkloadNetworkDeleteDnsZoneOperation() + { + } + + internal WorkloadNetworkDeleteDnsZoneOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkDeleteDnsZoneOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeletePortMirroringOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeletePortMirroringOperation.cs new file mode 100644 index 000000000000..800d36bb267d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeletePortMirroringOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a port mirroring profile by id in a private cloud workload network. + public partial class WorkloadNetworkDeletePortMirroringOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkDeletePortMirroringOperation for mocking. + protected WorkloadNetworkDeletePortMirroringOperation() + { + } + + internal WorkloadNetworkDeletePortMirroringOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkDeletePortMirroringOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeletePublicIPOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeletePublicIPOperation.cs new file mode 100644 index 000000000000..41cf6fccfad5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeletePublicIPOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a Public IP Block by id in a private cloud workload network. + public partial class WorkloadNetworkDeletePublicIPOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkDeletePublicIPOperation for mocking. + protected WorkloadNetworkDeletePublicIPOperation() + { + } + + internal WorkloadNetworkDeletePublicIPOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkDeletePublicIPOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteSegmentOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteSegmentOperation.cs new file mode 100644 index 000000000000..35c4ad8f7da2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteSegmentOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a segment by id in a private cloud workload network. + public partial class WorkloadNetworkDeleteSegmentOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkDeleteSegmentOperation for mocking. + protected WorkloadNetworkDeleteSegmentOperation() + { + } + + internal WorkloadNetworkDeleteSegmentOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkDeleteSegmentOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteVMGroupOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteVMGroupOperation.cs new file mode 100644 index 000000000000..1970f07f8988 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkDeleteVMGroupOperation.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Delete a vm group by id in a private cloud workload network. + public partial class WorkloadNetworkDeleteVMGroupOperation : Operation + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkDeleteVMGroupOperation for mocking. + protected WorkloadNetworkDeleteVMGroupOperation() + { + } + + internal WorkloadNetworkDeleteVMGroupOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkDeleteVMGroupOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDhcpOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDhcpOperation.cs new file mode 100644 index 000000000000..93a26ddfc45f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDhcpOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update dhcp by id in a private cloud workload network. + public partial class WorkloadNetworkUpdateDhcpOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkUpdateDhcpOperation for mocking. + protected WorkloadNetworkUpdateDhcpOperation() + { + } + + internal WorkloadNetworkUpdateDhcpOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateDhcpOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkDhcp Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkDhcp IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsServiceOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsServiceOperation.cs new file mode 100644 index 000000000000..3018cafe42ef --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsServiceOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a DNS service by id in a private cloud workload network. + public partial class WorkloadNetworkUpdateDnsServiceOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkUpdateDnsServiceOperation for mocking. + protected WorkloadNetworkUpdateDnsServiceOperation() + { + } + + internal WorkloadNetworkUpdateDnsServiceOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateDnsServiceOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkDnsService Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkDnsService IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsZoneOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsZoneOperation.cs new file mode 100644 index 000000000000..5351052b8c3a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsZoneOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a DNS zone by id in a private cloud workload network. + public partial class WorkloadNetworkUpdateDnsZoneOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkUpdateDnsZoneOperation for mocking. + protected WorkloadNetworkUpdateDnsZoneOperation() + { + } + + internal WorkloadNetworkUpdateDnsZoneOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateDnsZoneOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkDnsZone Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkDnsZone IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdatePortMirroringOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdatePortMirroringOperation.cs new file mode 100644 index 000000000000..e74586b1c5e3 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdatePortMirroringOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a port mirroring profile by id in a private cloud workload network. + public partial class WorkloadNetworkUpdatePortMirroringOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkUpdatePortMirroringOperation for mocking. + protected WorkloadNetworkUpdatePortMirroringOperation() + { + } + + internal WorkloadNetworkUpdatePortMirroringOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdatePortMirroringOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkPortMirroring Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkPortMirroring IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs new file mode 100644 index 000000000000..594be85653d7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a segment by id in a private cloud workload network. + public partial class WorkloadNetworkUpdateSegmentsOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + private readonly ArmResource _operationBase; + + /// Initializes a new instance of WorkloadNetworkUpdateSegmentsOperation for mocking. + protected WorkloadNetworkUpdateSegmentsOperation() + { + } + + internal WorkloadNetworkUpdateSegmentsOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateSegmentsOperation"); + _operationBase = operationsBase; + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkSegment Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkSegment IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return new WorkloadNetworkSegment(_operationBase, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement)); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return new WorkloadNetworkSegment(_operationBase, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateVMGroupOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateVMGroupOperation.cs new file mode 100644 index 000000000000..a9a5506e1226 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateVMGroupOperation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Create or update a vm group by id in a private cloud workload network. + public partial class WorkloadNetworkUpdateVMGroupOperation : Operation, IOperationSource + { + private readonly OperationInternals _operation; + + /// Initializes a new instance of WorkloadNetworkUpdateVMGroupOperation for mocking. + protected WorkloadNetworkUpdateVMGroupOperation() + { + } + + internal WorkloadNetworkUpdateVMGroupOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + { + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateVMGroupOperation"); + } + + /// + public override string Id => _operation.Id; + + /// + public override WorkloadNetworkVMGroup Value => _operation.Value; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override Response GetRawResponse() => _operation.GetRawResponse(); + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + + WorkloadNetworkVMGroup IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonData.Serialization.cs new file mode 100644 index 000000000000..ee1db6668f07 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonData.Serialization.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class AddonData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static AddonData DeserializeAddonData(JsonElement element) + { + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = AddonProperties.DeserializeAddonProperties(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new AddonData(id, name, type, properties.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs new file mode 100644 index 000000000000..25d7e1bbc0dd --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class AddonHcxProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("offer"); + writer.WriteStringValue(Offer); + writer.WritePropertyName("addonType"); + writer.WriteStringValue(AddonType.ToString()); + writer.WriteEndObject(); + } + + internal static AddonHcxProperties DeserializeAddonHcxProperties(JsonElement element) + { + string offer = default; + AddonType addonType = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offer")) + { + offer = property.Value.GetString(); + continue; + } + if (property.NameEquals("addonType")) + { + addonType = new AddonType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new AddonProvisioningState(property.Value.GetString()); + continue; + } + } + return new AddonHcxProperties(addonType, Optional.ToNullable(provisioningState), offer); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs new file mode 100644 index 000000000000..7674709b9ef7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonHcxProperties.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of an HCX addon. + public partial class AddonHcxProperties : AddonProperties + { + /// Initializes a new instance of AddonHcxProperties. + /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). + /// is null. + public AddonHcxProperties(string offer) + { + if (offer == null) + { + throw new ArgumentNullException(nameof(offer)); + } + + Offer = offer; + AddonType = AddonType.HCX; + } + + /// Initializes a new instance of AddonHcxProperties. + /// The type of private cloud addon. + /// The state of the addon provisioning. + /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). + internal AddonHcxProperties(AddonType addonType, AddonProvisioningState? provisioningState, string offer) : base(addonType, provisioningState) + { + Offer = offer; + AddonType = addonType; + } + + /// The HCX offer, example VMware MaaS Cloud Provider (Enterprise). + public string Offer { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs new file mode 100644 index 000000000000..d5d76137a751 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class AddonList + { + internal static AddonList DeserializeAddonList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AddonData.DeserializeAddonData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new AddonList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs new file mode 100644 index 000000000000..dd1bcf9c3e3f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A paged list of addons. + internal partial class AddonList + { + /// Initializes a new instance of AddonList. + internal AddonList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of AddonList. + /// The items on a page. + /// URL to get the next page if any. + internal AddonList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on a page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.Serialization.cs new file mode 100644 index 000000000000..8b4fc7358df7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class AddonProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("addonType"); + writer.WriteStringValue(AddonType.ToString()); + writer.WriteEndObject(); + } + + internal static AddonProperties DeserializeAddonProperties(JsonElement element) + { + if (element.TryGetProperty("addonType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "HCX": return AddonHcxProperties.DeserializeAddonHcxProperties(element); + case "SRM": return AddonSrmProperties.DeserializeAddonSrmProperties(element); + case "VR": return AddonVrProperties.DeserializeAddonVrProperties(element); + } + } + AddonType addonType = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("addonType")) + { + addonType = new AddonType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new AddonProvisioningState(property.Value.GetString()); + continue; + } + } + return new AddonProperties(addonType, Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.cs new file mode 100644 index 000000000000..29c58c00543e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of an addon. + public partial class AddonProperties + { + /// Initializes a new instance of AddonProperties. + public AddonProperties() + { + } + + /// Initializes a new instance of AddonProperties. + /// The type of private cloud addon. + /// The state of the addon provisioning. + internal AddonProperties(AddonType addonType, AddonProvisioningState? provisioningState) + { + AddonType = addonType; + ProvisioningState = provisioningState; + } + + /// The type of private cloud addon. + internal AddonType AddonType { get; set; } + /// The state of the addon provisioning. + public AddonProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProvisioningState.cs new file mode 100644 index 000000000000..b4a348f91849 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonProvisioningState.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The state of the addon provisioning. + public readonly partial struct AddonProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AddonProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CancelledValue = "Cancelled"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static AddonProvisioningState Succeeded { get; } = new AddonProvisioningState(SucceededValue); + /// Failed. + public static AddonProvisioningState Failed { get; } = new AddonProvisioningState(FailedValue); + /// Cancelled. + public static AddonProvisioningState Cancelled { get; } = new AddonProvisioningState(CancelledValue); + /// Building. + public static AddonProvisioningState Building { get; } = new AddonProvisioningState(BuildingValue); + /// Deleting. + public static AddonProvisioningState Deleting { get; } = new AddonProvisioningState(DeletingValue); + /// Updating. + public static AddonProvisioningState Updating { get; } = new AddonProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(AddonProvisioningState left, AddonProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AddonProvisioningState left, AddonProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AddonProvisioningState(string value) => new AddonProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AddonProvisioningState other && Equals(other); + /// + public bool Equals(AddonProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.Serialization.cs new file mode 100644 index 000000000000..075bca239117 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class AddonSrmProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(LicenseKey)) + { + writer.WritePropertyName("licenseKey"); + writer.WriteStringValue(LicenseKey); + } + writer.WritePropertyName("addonType"); + writer.WriteStringValue(AddonType.ToString()); + writer.WriteEndObject(); + } + + internal static AddonSrmProperties DeserializeAddonSrmProperties(JsonElement element) + { + Optional licenseKey = default; + AddonType addonType = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("licenseKey")) + { + licenseKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("addonType")) + { + addonType = new AddonType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new AddonProvisioningState(property.Value.GetString()); + continue; + } + } + return new AddonSrmProperties(addonType, Optional.ToNullable(provisioningState), licenseKey.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs new file mode 100644 index 000000000000..6c371b40d4d7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonSrmProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a Site Recovery Manager (SRM) addon. + public partial class AddonSrmProperties : AddonProperties + { + /// Initializes a new instance of AddonSrmProperties. + public AddonSrmProperties() + { + AddonType = AddonType.SRM; + } + + /// Initializes a new instance of AddonSrmProperties. + /// The type of private cloud addon. + /// The state of the addon provisioning. + /// The Site Recovery Manager (SRM) license. + internal AddonSrmProperties(AddonType addonType, AddonProvisioningState? provisioningState, string licenseKey) : base(addonType, provisioningState) + { + LicenseKey = licenseKey; + AddonType = addonType; + } + + /// The Site Recovery Manager (SRM) license. + public string LicenseKey { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonType.cs new file mode 100644 index 000000000000..538eb71ad7e9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The type of private cloud addon. + public readonly partial struct AddonType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AddonType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SRMValue = "SRM"; + private const string VRValue = "VR"; + private const string HCXValue = "HCX"; + + /// SRM. + public static AddonType SRM { get; } = new AddonType(SRMValue); + /// VR. + public static AddonType VR { get; } = new AddonType(VRValue); + /// HCX. + public static AddonType HCX { get; } = new AddonType(HCXValue); + /// Determines if two values are the same. + public static bool operator ==(AddonType left, AddonType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AddonType left, AddonType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AddonType(string value) => new AddonType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AddonType other && Equals(other); + /// + public bool Equals(AddonType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.Serialization.cs new file mode 100644 index 000000000000..4bae7c728a3e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class AddonVrProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("vrsCount"); + writer.WriteNumberValue(VrsCount); + writer.WritePropertyName("addonType"); + writer.WriteStringValue(AddonType.ToString()); + writer.WriteEndObject(); + } + + internal static AddonVrProperties DeserializeAddonVrProperties(JsonElement element) + { + int vrsCount = default; + AddonType addonType = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vrsCount")) + { + vrsCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("addonType")) + { + addonType = new AddonType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new AddonProvisioningState(property.Value.GetString()); + continue; + } + } + return new AddonVrProperties(addonType, Optional.ToNullable(provisioningState), vrsCount); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs new file mode 100644 index 000000000000..f74a75068691 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonVrProperties.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a vSphere Replication (VR) addon. + public partial class AddonVrProperties : AddonProperties + { + /// Initializes a new instance of AddonVrProperties. + /// The vSphere Replication Server (VRS) count. + public AddonVrProperties(int vrsCount) + { + VrsCount = vrsCount; + AddonType = AddonType.VR; + } + + /// Initializes a new instance of AddonVrProperties. + /// The type of private cloud addon. + /// The state of the addon provisioning. + /// The vSphere Replication Server (VRS) count. + internal AddonVrProperties(AddonType addonType, AddonProvisioningState? provisioningState, int vrsCount) : base(addonType, provisioningState) + { + VrsCount = vrsCount; + AddonType = addonType; + } + + /// The vSphere Replication Server (VRS) count. + public int VrsCount { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs new file mode 100644 index 000000000000..7432c1578f5b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class AdminCredentials + { + internal static AdminCredentials DeserializeAdminCredentials(JsonElement element) + { + Optional nsxtUsername = default; + Optional nsxtPassword = default; + Optional vcenterUsername = default; + Optional vcenterPassword = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nsxtUsername")) + { + nsxtUsername = property.Value.GetString(); + continue; + } + if (property.NameEquals("nsxtPassword")) + { + nsxtPassword = property.Value.GetString(); + continue; + } + if (property.NameEquals("vcenterUsername")) + { + vcenterUsername = property.Value.GetString(); + continue; + } + if (property.NameEquals("vcenterPassword")) + { + vcenterPassword = property.Value.GetString(); + continue; + } + } + return new AdminCredentials(nsxtUsername.Value, nsxtPassword.Value, vcenterUsername.Value, vcenterPassword.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs new file mode 100644 index 000000000000..742794aa5fd5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AdminCredentials.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// Administrative credentials for accessing vCenter and NSX-T. + public partial class AdminCredentials + { + /// Initializes a new instance of AdminCredentials. + internal AdminCredentials() + { + } + + /// Initializes a new instance of AdminCredentials. + /// NSX-T Manager username. + /// NSX-T Manager password. + /// vCenter admin username. + /// vCenter admin password. + internal AdminCredentials(string nsxtUsername, string nsxtPassword, string vcenterUsername, string vcenterPassword) + { + NsxtUsername = nsxtUsername; + NsxtPassword = nsxtPassword; + VcenterUsername = vcenterUsername; + VcenterPassword = vcenterPassword; + } + + /// NSX-T Manager username. + public string NsxtUsername { get; } + /// NSX-T Manager password. + public string NsxtPassword { get; } + /// vCenter admin username. + public string VcenterUsername { get; } + /// vCenter admin password. + public string VcenterPassword { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AffinityType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AffinityType.cs new file mode 100644 index 000000000000..9770d2814d30 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AffinityType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Placement policy affinity type. + public readonly partial struct AffinityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AffinityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AffinityValue = "Affinity"; + private const string AntiAffinityValue = "AntiAffinity"; + + /// Affinity. + public static AffinityType Affinity { get; } = new AffinityType(AffinityValue); + /// AntiAffinity. + public static AffinityType AntiAffinity { get; } = new AffinityType(AntiAffinityValue); + /// Determines if two values are the same. + public static bool operator ==(AffinityType left, AffinityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AffinityType left, AffinityType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AffinityType(string value) => new AffinityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AffinityType other && Equals(other); + /// + public bool Equals(AffinityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.Serialization.cs new file mode 100644 index 000000000000..ff59b7938db5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.Serialization.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class AvailabilityProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Strategy)) + { + writer.WritePropertyName("strategy"); + writer.WriteStringValue(Strategy.Value.ToString()); + } + if (Optional.IsDefined(Zone)) + { + writer.WritePropertyName("zone"); + writer.WriteNumberValue(Zone.Value); + } + if (Optional.IsDefined(SecondaryZone)) + { + writer.WritePropertyName("secondaryZone"); + writer.WriteNumberValue(SecondaryZone.Value); + } + writer.WriteEndObject(); + } + + internal static AvailabilityProperties DeserializeAvailabilityProperties(JsonElement element) + { + Optional strategy = default; + Optional zone = default; + Optional secondaryZone = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("strategy")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + strategy = new AvailabilityStrategy(property.Value.GetString()); + continue; + } + if (property.NameEquals("zone")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + zone = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("secondaryZone")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + secondaryZone = property.Value.GetInt32(); + continue; + } + } + return new AvailabilityProperties(Optional.ToNullable(strategy), Optional.ToNullable(zone), Optional.ToNullable(secondaryZone)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.cs new file mode 100644 index 000000000000..b34aa295bcde --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties describing private cloud availability zone distribution. + public partial class AvailabilityProperties + { + /// Initializes a new instance of AvailabilityProperties. + public AvailabilityProperties() + { + } + + /// Initializes a new instance of AvailabilityProperties. + /// The availability strategy for the private cloud. + /// The primary availability zone for the private cloud. + /// The secondary availability zone for the private cloud. + internal AvailabilityProperties(AvailabilityStrategy? strategy, int? zone, int? secondaryZone) + { + Strategy = strategy; + Zone = zone; + SecondaryZone = secondaryZone; + } + + /// The availability strategy for the private cloud. + public AvailabilityStrategy? Strategy { get; set; } + /// The primary availability zone for the private cloud. + public int? Zone { get; set; } + /// The secondary availability zone for the private cloud. + public int? SecondaryZone { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityStrategy.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityStrategy.cs new file mode 100644 index 000000000000..ac457c997010 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AvailabilityStrategy.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The availability strategy for the private cloud. + public readonly partial struct AvailabilityStrategy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AvailabilityStrategy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SingleZoneValue = "SingleZone"; + private const string DualZoneValue = "DualZone"; + + /// SingleZone. + public static AvailabilityStrategy SingleZone { get; } = new AvailabilityStrategy(SingleZoneValue); + /// DualZone. + public static AvailabilityStrategy DualZone { get; } = new AvailabilityStrategy(DualZoneValue); + /// Determines if two values are the same. + public static bool operator ==(AvailabilityStrategy left, AvailabilityStrategy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AvailabilityStrategy left, AvailabilityStrategy right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AvailabilityStrategy(string value) => new AvailabilityStrategy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AvailabilityStrategy other && Equals(other); + /// + public bool Equals(AvailabilityStrategy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.Serialization.cs new file mode 100644 index 000000000000..43d0cfce120d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class Circuit : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static Circuit DeserializeCircuit(JsonElement element) + { + Optional primarySubnet = default; + Optional secondarySubnet = default; + Optional expressRouteID = default; + Optional expressRoutePrivatePeeringID = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("primarySubnet")) + { + primarySubnet = property.Value.GetString(); + continue; + } + if (property.NameEquals("secondarySubnet")) + { + secondarySubnet = property.Value.GetString(); + continue; + } + if (property.NameEquals("expressRouteID")) + { + expressRouteID = property.Value.GetString(); + continue; + } + if (property.NameEquals("expressRoutePrivatePeeringID")) + { + expressRoutePrivatePeeringID = property.Value.GetString(); + continue; + } + } + return new Circuit(primarySubnet.Value, secondarySubnet.Value, expressRouteID.Value, expressRoutePrivatePeeringID.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.cs new file mode 100644 index 000000000000..7e409fb32f57 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Circuit.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// An ExpressRoute Circuit. + public partial class Circuit + { + /// Initializes a new instance of Circuit. + public Circuit() + { + } + + /// Initializes a new instance of Circuit. + /// CIDR of primary subnet. + /// CIDR of secondary subnet. + /// Identifier of the ExpressRoute Circuit (Microsoft Colo only). + /// ExpressRoute Circuit private peering identifier. + internal Circuit(string primarySubnet, string secondarySubnet, string expressRouteID, string expressRoutePrivatePeeringID) + { + PrimarySubnet = primarySubnet; + SecondarySubnet = secondarySubnet; + ExpressRouteID = expressRouteID; + ExpressRoutePrivatePeeringID = expressRoutePrivatePeeringID; + } + + /// CIDR of primary subnet. + public string PrimarySubnet { get; } + /// CIDR of secondary subnet. + public string SecondarySubnet { get; } + /// Identifier of the ExpressRoute Circuit (Microsoft Colo only). + public string ExpressRouteID { get; } + /// ExpressRoute Circuit private peering identifier. + public string ExpressRoutePrivatePeeringID { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkData.Serialization.cs new file mode 100644 index 000000000000..b2dd2911a65b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkData.Serialization.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class CloudLinkData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(LinkedCloud)) + { + writer.WritePropertyName("linkedCloud"); + writer.WriteStringValue(LinkedCloud); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static CloudLinkData DeserializeCloudLinkData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional status = default; + Optional linkedCloud = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("status")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new CloudLinkStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("linkedCloud")) + { + linkedCloud = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new CloudLinkData(id, name, type, Optional.ToNullable(status), linkedCloud.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs new file mode 100644 index 000000000000..9c6d4d86d2f5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class CloudLinkList + { + internal static CloudLinkList DeserializeCloudLinkList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CloudLinkData.DeserializeCloudLinkData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new CloudLinkList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs new file mode 100644 index 000000000000..07218961c5e0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A paged list of cloud links. + internal partial class CloudLinkList + { + /// Initializes a new instance of CloudLinkList. + internal CloudLinkList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of CloudLinkList. + /// The items on a page. + /// URL to get the next page if any. + internal CloudLinkList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on a page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkStatus.cs new file mode 100644 index 000000000000..ab89555136ea --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkStatus.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The state of the cloud link. + public readonly partial struct CloudLinkStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CloudLinkStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string FailedValue = "Failed"; + private const string DisconnectedValue = "Disconnected"; + + /// Active. + public static CloudLinkStatus Active { get; } = new CloudLinkStatus(ActiveValue); + /// Building. + public static CloudLinkStatus Building { get; } = new CloudLinkStatus(BuildingValue); + /// Deleting. + public static CloudLinkStatus Deleting { get; } = new CloudLinkStatus(DeletingValue); + /// Failed. + public static CloudLinkStatus Failed { get; } = new CloudLinkStatus(FailedValue); + /// Disconnected. + public static CloudLinkStatus Disconnected { get; } = new CloudLinkStatus(DisconnectedValue); + /// Determines if two values are the same. + public static bool operator ==(CloudLinkStatus left, CloudLinkStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CloudLinkStatus left, CloudLinkStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator CloudLinkStatus(string value) => new CloudLinkStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CloudLinkStatus other && Equals(other); + /// + public bool Equals(CloudLinkStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterData.Serialization.cs new file mode 100644 index 000000000000..032d2f003091 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterData.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class ClusterData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(ClusterSize)) + { + writer.WritePropertyName("clusterSize"); + writer.WriteNumberValue(ClusterSize.Value); + } + if (Optional.IsCollectionDefined(Hosts)) + { + writer.WritePropertyName("hosts"); + writer.WriteStartArray(); + foreach (var item in Hosts) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ClusterData DeserializeClusterData(JsonElement element) + { + Sku sku = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional clusterSize = default; + Optional provisioningState = default; + Optional clusterId = default; + Optional> hosts = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku")) + { + sku = Sku.DeserializeSku(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("clusterSize")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + clusterSize = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new ClusterProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("clusterId")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + clusterId = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("hosts")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + hosts = array; + continue; + } + } + continue; + } + } + return new ClusterData(id, name, type, sku, Optional.ToNullable(clusterSize), Optional.ToNullable(provisioningState), Optional.ToNullable(clusterId), Optional.ToList(hosts)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs new file mode 100644 index 000000000000..fb523237c33b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class ClusterList + { + internal static ClusterList DeserializeClusterList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClusterData.DeserializeClusterData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ClusterList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs new file mode 100644 index 000000000000..ecf2a7762559 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A paged list of clusters. + internal partial class ClusterList + { + /// Initializes a new instance of ClusterList. + internal ClusterList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ClusterList. + /// The items on a page. + /// URL to get the next page if any. + internal ClusterList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on a page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.Serialization.cs new file mode 100644 index 000000000000..cb10080d9519 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.Serialization.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class ClusterProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ClusterSize)) + { + writer.WritePropertyName("clusterSize"); + writer.WriteNumberValue(ClusterSize.Value); + } + if (Optional.IsCollectionDefined(Hosts)) + { + writer.WritePropertyName("hosts"); + writer.WriteStartArray(); + foreach (var item in Hosts) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static ClusterProperties DeserializeClusterProperties(JsonElement element) + { + Optional clusterSize = default; + Optional provisioningState = default; + Optional clusterId = default; + Optional> hosts = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clusterSize")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + clusterSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new ClusterProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("clusterId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + clusterId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("hosts")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + hosts = array; + continue; + } + } + return new ClusterProperties(Optional.ToNullable(clusterSize), Optional.ToNullable(provisioningState), Optional.ToNullable(clusterId), Optional.ToList(hosts)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.cs new file mode 100644 index 000000000000..9be99b6641eb --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProperties.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a cluster. + public partial class ClusterProperties : CommonClusterProperties + { + /// Initializes a new instance of ClusterProperties. + public ClusterProperties() + { + } + + /// Initializes a new instance of ClusterProperties. + /// The cluster size. + /// The state of the cluster provisioning. + /// The identity. + /// The hosts. + internal ClusterProperties(int? clusterSize, ClusterProvisioningState? provisioningState, int? clusterId, IList hosts) : base(clusterSize, provisioningState, clusterId, hosts) + { + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProvisioningState.cs new file mode 100644 index 000000000000..363d1764ffbd --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The state of the cluster provisioning. + public readonly partial struct ClusterProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ClusterProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CancelledValue = "Cancelled"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static ClusterProvisioningState Succeeded { get; } = new ClusterProvisioningState(SucceededValue); + /// Failed. + public static ClusterProvisioningState Failed { get; } = new ClusterProvisioningState(FailedValue); + /// Cancelled. + public static ClusterProvisioningState Cancelled { get; } = new ClusterProvisioningState(CancelledValue); + /// Deleting. + public static ClusterProvisioningState Deleting { get; } = new ClusterProvisioningState(DeletingValue); + /// Updating. + public static ClusterProvisioningState Updating { get; } = new ClusterProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(ClusterProvisioningState left, ClusterProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ClusterProvisioningState left, ClusterProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ClusterProvisioningState(string value) => new ClusterProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ClusterProvisioningState other && Equals(other); + /// + public bool Equals(ClusterProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterUpdate.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterUpdate.Serialization.cs new file mode 100644 index 000000000000..4ef6ad499765 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterUpdate.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class ClusterUpdate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(ClusterSize)) + { + writer.WritePropertyName("clusterSize"); + writer.WriteNumberValue(ClusterSize.Value); + } + if (Optional.IsCollectionDefined(Hosts)) + { + writer.WritePropertyName("hosts"); + writer.WriteStartArray(); + foreach (var item in Hosts) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterUpdate.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterUpdate.cs new file mode 100644 index 000000000000..db3f1c2a98c4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterUpdate.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// An update of a cluster resource. + public partial class ClusterUpdate + { + /// Initializes a new instance of ClusterUpdate. + public ClusterUpdate() + { + Hosts = new ChangeTrackingList(); + } + + /// The cluster size. + public int? ClusterSize { get; set; } + /// The hosts. + public IList Hosts { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.Serialization.cs new file mode 100644 index 000000000000..bec7a998cf07 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.Serialization.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class CommonClusterProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ClusterSize)) + { + writer.WritePropertyName("clusterSize"); + writer.WriteNumberValue(ClusterSize.Value); + } + if (Optional.IsCollectionDefined(Hosts)) + { + writer.WritePropertyName("hosts"); + writer.WriteStartArray(); + foreach (var item in Hosts) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static CommonClusterProperties DeserializeCommonClusterProperties(JsonElement element) + { + Optional clusterSize = default; + Optional provisioningState = default; + Optional clusterId = default; + Optional> hosts = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clusterSize")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + clusterSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new ClusterProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("clusterId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + clusterId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("hosts")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + hosts = array; + continue; + } + } + return new CommonClusterProperties(Optional.ToNullable(clusterSize), Optional.ToNullable(provisioningState), Optional.ToNullable(clusterId), Optional.ToList(hosts)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.cs new file mode 100644 index 000000000000..e6a0abdf682c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CommonClusterProperties.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The common properties of a cluster. + public partial class CommonClusterProperties + { + /// Initializes a new instance of CommonClusterProperties. + public CommonClusterProperties() + { + Hosts = new ChangeTrackingList(); + } + + /// Initializes a new instance of CommonClusterProperties. + /// The cluster size. + /// The state of the cluster provisioning. + /// The identity. + /// The hosts. + internal CommonClusterProperties(int? clusterSize, ClusterProvisioningState? provisioningState, int? clusterId, IList hosts) + { + ClusterSize = clusterSize; + ProvisioningState = provisioningState; + ClusterId = clusterId; + Hosts = hosts; + } + + /// The cluster size. + public int? ClusterSize { get; set; } + /// The state of the cluster provisioning. + public ClusterProvisioningState? ProvisioningState { get; } + /// The identity. + public int? ClusterId { get; } + /// The hosts. + public IList Hosts { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreData.Serialization.cs new file mode 100644 index 000000000000..0807ab58a9f6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreData.Serialization.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class DatastoreData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(NetAppVolume)) + { + writer.WritePropertyName("netAppVolume"); + JsonSerializer.Serialize(writer, NetAppVolume); + } + if (Optional.IsDefined(DiskPoolVolume)) + { + writer.WritePropertyName("diskPoolVolume"); + writer.WriteObjectValue(DiskPoolVolume); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DatastoreData DeserializeDatastoreData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional provisioningState = default; + Optional netAppVolume = default; + Optional diskPoolVolume = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new DatastoreProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("netAppVolume")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + netAppVolume = JsonSerializer.Deserialize(property0.Value.ToString()); + continue; + } + if (property0.NameEquals("diskPoolVolume")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + diskPoolVolume = DiskPoolVolume.DeserializeDiskPoolVolume(property0.Value); + continue; + } + if (property0.NameEquals("status")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new DatastoreStatus(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new DatastoreData(id, name, type, Optional.ToNullable(provisioningState), netAppVolume, diskPoolVolume.Value, Optional.ToNullable(status)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs new file mode 100644 index 000000000000..48478f99485f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class DatastoreList + { + internal static DatastoreList DeserializeDatastoreList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatastoreData.DeserializeDatastoreData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DatastoreList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs new file mode 100644 index 000000000000..6af1568d3360 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A paged list of datastores. + internal partial class DatastoreList + { + /// Initializes a new instance of DatastoreList. + internal DatastoreList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DatastoreList. + /// The items on a page. + /// URL to get the next page if any. + internal DatastoreList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on a page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProvisioningState.cs new file mode 100644 index 000000000000..782475a67bc7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The state of the datastore provisioning. + public readonly partial struct DatastoreProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DatastoreProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CancelledValue = "Cancelled"; + private const string PendingValue = "Pending"; + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + + /// Succeeded. + public static DatastoreProvisioningState Succeeded { get; } = new DatastoreProvisioningState(SucceededValue); + /// Failed. + public static DatastoreProvisioningState Failed { get; } = new DatastoreProvisioningState(FailedValue); + /// Cancelled. + public static DatastoreProvisioningState Cancelled { get; } = new DatastoreProvisioningState(CancelledValue); + /// Pending. + public static DatastoreProvisioningState Pending { get; } = new DatastoreProvisioningState(PendingValue); + /// Creating. + public static DatastoreProvisioningState Creating { get; } = new DatastoreProvisioningState(CreatingValue); + /// Updating. + public static DatastoreProvisioningState Updating { get; } = new DatastoreProvisioningState(UpdatingValue); + /// Deleting. + public static DatastoreProvisioningState Deleting { get; } = new DatastoreProvisioningState(DeletingValue); + /// Determines if two values are the same. + public static bool operator ==(DatastoreProvisioningState left, DatastoreProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatastoreProvisioningState left, DatastoreProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DatastoreProvisioningState(string value) => new DatastoreProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatastoreProvisioningState other && Equals(other); + /// + public bool Equals(DatastoreProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreStatus.cs new file mode 100644 index 000000000000..950aa04d303c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreStatus.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The operational status of the datastore. + public readonly partial struct DatastoreStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DatastoreStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string AccessibleValue = "Accessible"; + private const string InaccessibleValue = "Inaccessible"; + private const string AttachedValue = "Attached"; + private const string DetachedValue = "Detached"; + private const string LostCommunicationValue = "LostCommunication"; + private const string DeadOrErrorValue = "DeadOrError"; + + /// Unknown. + public static DatastoreStatus Unknown { get; } = new DatastoreStatus(UnknownValue); + /// Accessible. + public static DatastoreStatus Accessible { get; } = new DatastoreStatus(AccessibleValue); + /// Inaccessible. + public static DatastoreStatus Inaccessible { get; } = new DatastoreStatus(InaccessibleValue); + /// Attached. + public static DatastoreStatus Attached { get; } = new DatastoreStatus(AttachedValue); + /// Detached. + public static DatastoreStatus Detached { get; } = new DatastoreStatus(DetachedValue); + /// LostCommunication. + public static DatastoreStatus LostCommunication { get; } = new DatastoreStatus(LostCommunicationValue); + /// DeadOrError. + public static DatastoreStatus DeadOrError { get; } = new DatastoreStatus(DeadOrErrorValue); + /// Determines if two values are the same. + public static bool operator ==(DatastoreStatus left, DatastoreStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatastoreStatus left, DatastoreStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DatastoreStatus(string value) => new DatastoreStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatastoreStatus other && Equals(other); + /// + public bool Equals(DatastoreStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DhcpTypeEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DhcpTypeEnum.cs new file mode 100644 index 000000000000..73c9a9777db8 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DhcpTypeEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Type of DHCP: SERVER or RELAY. + public readonly partial struct DhcpTypeEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DhcpTypeEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ServerValue = "SERVER"; + private const string RelayValue = "RELAY"; + + /// SERVER. + public static DhcpTypeEnum Server { get; } = new DhcpTypeEnum(ServerValue); + /// RELAY. + public static DhcpTypeEnum Relay { get; } = new DhcpTypeEnum(RelayValue); + /// Determines if two values are the same. + public static bool operator ==(DhcpTypeEnum left, DhcpTypeEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DhcpTypeEnum left, DhcpTypeEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DhcpTypeEnum(string value) => new DhcpTypeEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DhcpTypeEnum other && Equals(other); + /// + public bool Equals(DhcpTypeEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs new file mode 100644 index 000000000000..793b504b20e9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class DiskPoolVolume : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("targetId"); + writer.WriteStringValue(TargetId); + writer.WritePropertyName("lunName"); + writer.WriteStringValue(LunName); + if (Optional.IsDefined(MountOption)) + { + writer.WritePropertyName("mountOption"); + writer.WriteStringValue(MountOption.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static DiskPoolVolume DeserializeDiskPoolVolume(JsonElement element) + { + string targetId = default; + string lunName = default; + Optional mountOption = default; + Optional path = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetId")) + { + targetId = property.Value.GetString(); + continue; + } + if (property.NameEquals("lunName")) + { + lunName = property.Value.GetString(); + continue; + } + if (property.NameEquals("mountOption")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + mountOption = new MountOptionEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("path")) + { + path = property.Value.GetString(); + continue; + } + } + return new DiskPoolVolume(targetId, lunName, Optional.ToNullable(mountOption), path.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs new file mode 100644 index 000000000000..64905f997329 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DiskPoolVolume.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Avs.Models +{ + /// An iSCSI volume from Microsoft.StoragePool provider. + public partial class DiskPoolVolume + { + /// Initializes a new instance of DiskPoolVolume. + /// Azure resource ID of the iSCSI target. + /// Name of the LUN to be used for datastore. + /// or is null. + public DiskPoolVolume(string targetId, string lunName) + { + if (targetId == null) + { + throw new ArgumentNullException(nameof(targetId)); + } + if (lunName == null) + { + throw new ArgumentNullException(nameof(lunName)); + } + + TargetId = targetId; + LunName = lunName; + } + + /// Initializes a new instance of DiskPoolVolume. + /// Azure resource ID of the iSCSI target. + /// Name of the LUN to be used for datastore. + /// Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN. + /// Device path. + internal DiskPoolVolume(string targetId, string lunName, MountOptionEnum? mountOption, string path) + { + TargetId = targetId; + LunName = lunName; + MountOption = mountOption; + Path = path; + } + + /// Azure resource ID of the iSCSI target. + public string TargetId { get; set; } + /// Name of the LUN to be used for datastore. + public string LunName { get; set; } + /// Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN. + public MountOptionEnum? MountOption { get; set; } + /// Device path. + public string Path { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceLogLevelEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceLogLevelEnum.cs new file mode 100644 index 000000000000..1e2c26400277 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceLogLevelEnum.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// DNS Service log level. + public readonly partial struct DnsServiceLogLevelEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DnsServiceLogLevelEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DebugValue = "DEBUG"; + private const string InfoValue = "INFO"; + private const string WarningValue = "WARNING"; + private const string ErrorValue = "ERROR"; + private const string FatalValue = "FATAL"; + + /// DEBUG. + public static DnsServiceLogLevelEnum Debug { get; } = new DnsServiceLogLevelEnum(DebugValue); + /// INFO. + public static DnsServiceLogLevelEnum Info { get; } = new DnsServiceLogLevelEnum(InfoValue); + /// WARNING. + public static DnsServiceLogLevelEnum Warning { get; } = new DnsServiceLogLevelEnum(WarningValue); + /// ERROR. + public static DnsServiceLogLevelEnum Error { get; } = new DnsServiceLogLevelEnum(ErrorValue); + /// FATAL. + public static DnsServiceLogLevelEnum Fatal { get; } = new DnsServiceLogLevelEnum(FatalValue); + /// Determines if two values are the same. + public static bool operator ==(DnsServiceLogLevelEnum left, DnsServiceLogLevelEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DnsServiceLogLevelEnum left, DnsServiceLogLevelEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DnsServiceLogLevelEnum(string value) => new DnsServiceLogLevelEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DnsServiceLogLevelEnum other && Equals(other); + /// + public bool Equals(DnsServiceLogLevelEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceStatusEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceStatusEnum.cs new file mode 100644 index 000000000000..9dd39dcb0aaf --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DnsServiceStatusEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// DNS Service status. + public readonly partial struct DnsServiceStatusEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DnsServiceStatusEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SuccessValue = "SUCCESS"; + private const string FailureValue = "FAILURE"; + + /// SUCCESS. + public static DnsServiceStatusEnum Success { get; } = new DnsServiceStatusEnum(SuccessValue); + /// FAILURE. + public static DnsServiceStatusEnum Failure { get; } = new DnsServiceStatusEnum(FailureValue); + /// Determines if two values are the same. + public static bool operator ==(DnsServiceStatusEnum left, DnsServiceStatusEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DnsServiceStatusEnum left, DnsServiceStatusEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DnsServiceStatusEnum(string value) => new DnsServiceStatusEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DnsServiceStatusEnum other && Equals(other); + /// + public bool Equals(DnsServiceStatusEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.Serialization.cs new file mode 100644 index 000000000000..eb75dd016f36 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class Encryption : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(KeyVaultProperties)) + { + writer.WritePropertyName("keyVaultProperties"); + writer.WriteObjectValue(KeyVaultProperties); + } + writer.WriteEndObject(); + } + + internal static Encryption DeserializeEncryption(JsonElement element) + { + Optional status = default; + Optional keyVaultProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new EncryptionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("keyVaultProperties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + keyVaultProperties = EncryptionKeyVaultProperties.DeserializeEncryptionKeyVaultProperties(property.Value); + continue; + } + } + return new Encryption(Optional.ToNullable(status), keyVaultProperties.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.cs new file mode 100644 index 000000000000..a469ad942a36 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Encryption.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of customer managed encryption key. + public partial class Encryption + { + /// Initializes a new instance of Encryption. + public Encryption() + { + } + + /// Initializes a new instance of Encryption. + /// Status of customer managed encryption key. + /// The key vault where the encryption key is stored. + internal Encryption(EncryptionState? status, EncryptionKeyVaultProperties keyVaultProperties) + { + Status = status; + KeyVaultProperties = keyVaultProperties; + } + + /// Status of customer managed encryption key. + public EncryptionState? Status { get; set; } + /// The key vault where the encryption key is stored. + public EncryptionKeyVaultProperties KeyVaultProperties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyStatus.cs new file mode 100644 index 000000000000..6205e6a3b784 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The state of key provided. + public readonly partial struct EncryptionKeyStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EncryptionKeyStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConnectedValue = "Connected"; + private const string AccessDeniedValue = "AccessDenied"; + + /// Connected. + public static EncryptionKeyStatus Connected { get; } = new EncryptionKeyStatus(ConnectedValue); + /// AccessDenied. + public static EncryptionKeyStatus AccessDenied { get; } = new EncryptionKeyStatus(AccessDeniedValue); + /// Determines if two values are the same. + public static bool operator ==(EncryptionKeyStatus left, EncryptionKeyStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EncryptionKeyStatus left, EncryptionKeyStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EncryptionKeyStatus(string value) => new EncryptionKeyStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EncryptionKeyStatus other && Equals(other); + /// + public bool Equals(EncryptionKeyStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.Serialization.cs new file mode 100644 index 000000000000..0343a7f91ca5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.Serialization.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class EncryptionKeyVaultProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(KeyName)) + { + writer.WritePropertyName("keyName"); + writer.WriteStringValue(KeyName); + } + if (Optional.IsDefined(KeyVersion)) + { + writer.WritePropertyName("keyVersion"); + writer.WriteStringValue(KeyVersion); + } + if (Optional.IsDefined(KeyVaultUrl)) + { + writer.WritePropertyName("keyVaultUrl"); + writer.WriteStringValue(KeyVaultUrl); + } + writer.WriteEndObject(); + } + + internal static EncryptionKeyVaultProperties DeserializeEncryptionKeyVaultProperties(JsonElement element) + { + Optional keyName = default; + Optional keyVersion = default; + Optional keyVaultUrl = default; + Optional keyState = default; + Optional versionType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyName")) + { + keyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyVersion")) + { + keyVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyVaultUrl")) + { + keyVaultUrl = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + keyState = new EncryptionKeyStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("versionType")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + versionType = new EncryptionVersionType(property.Value.GetString()); + continue; + } + } + return new EncryptionKeyVaultProperties(keyName.Value, keyVersion.Value, keyVaultUrl.Value, Optional.ToNullable(keyState), Optional.ToNullable(versionType)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.cs new file mode 100644 index 000000000000..39047edc1d07 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionKeyVaultProperties.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// An Encryption Key. + public partial class EncryptionKeyVaultProperties + { + /// Initializes a new instance of EncryptionKeyVaultProperties. + public EncryptionKeyVaultProperties() + { + } + + /// Initializes a new instance of EncryptionKeyVaultProperties. + /// The name of the key. + /// The version of the key. + /// The URL of the vault. + /// The state of key provided. + /// Property of the key if user provided or auto detected. + internal EncryptionKeyVaultProperties(string keyName, string keyVersion, string keyVaultUrl, EncryptionKeyStatus? keyState, EncryptionVersionType? versionType) + { + KeyName = keyName; + KeyVersion = keyVersion; + KeyVaultUrl = keyVaultUrl; + KeyState = keyState; + VersionType = versionType; + } + + /// The name of the key. + public string KeyName { get; set; } + /// The version of the key. + public string KeyVersion { get; set; } + /// The URL of the vault. + public string KeyVaultUrl { get; set; } + /// The state of key provided. + public EncryptionKeyStatus? KeyState { get; } + /// Property of the key if user provided or auto detected. + public EncryptionVersionType? VersionType { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionState.cs new file mode 100644 index 000000000000..637a737434b8 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Status of customer managed encryption key. + public readonly partial struct EncryptionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EncryptionState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static EncryptionState Enabled { get; } = new EncryptionState(EnabledValue); + /// Disabled. + public static EncryptionState Disabled { get; } = new EncryptionState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(EncryptionState left, EncryptionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EncryptionState left, EncryptionState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EncryptionState(string value) => new EncryptionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EncryptionState other && Equals(other); + /// + public bool Equals(EncryptionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionVersionType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionVersionType.cs new file mode 100644 index 000000000000..71b0b7ce5c2e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/EncryptionVersionType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Property of the key if user provided or auto detected. + public readonly partial struct EncryptionVersionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EncryptionVersionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FixedValue = "Fixed"; + private const string AutoDetectedValue = "AutoDetected"; + + /// Fixed. + public static EncryptionVersionType Fixed { get; } = new EncryptionVersionType(FixedValue); + /// AutoDetected. + public static EncryptionVersionType AutoDetected { get; } = new EncryptionVersionType(AutoDetectedValue); + /// Determines if two values are the same. + public static bool operator ==(EncryptionVersionType left, EncryptionVersionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EncryptionVersionType left, EncryptionVersionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EncryptionVersionType(string value) => new EncryptionVersionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EncryptionVersionType other && Equals(other); + /// + public bool Equals(EncryptionVersionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.Serialization.cs new file mode 100644 index 000000000000..9d5a59867d01 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class Endpoints + { + internal static Endpoints DeserializeEndpoints(JsonElement element) + { + Optional nsxtManager = default; + Optional vcsa = default; + Optional hcxCloudManager = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nsxtManager")) + { + nsxtManager = property.Value.GetString(); + continue; + } + if (property.NameEquals("vcsa")) + { + vcsa = property.Value.GetString(); + continue; + } + if (property.NameEquals("hcxCloudManager")) + { + hcxCloudManager = property.Value.GetString(); + continue; + } + } + return new Endpoints(nsxtManager.Value, vcsa.Value, hcxCloudManager.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.cs new file mode 100644 index 000000000000..64200583359b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Endpoints.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// Endpoint addresses. + public partial class Endpoints + { + /// Initializes a new instance of Endpoints. + internal Endpoints() + { + } + + /// Initializes a new instance of Endpoints. + /// Endpoint for the NSX-T Data Center manager. + /// Endpoint for Virtual Center Server Appliance. + /// Endpoint for the HCX Cloud Manager. + internal Endpoints(string nsxtManager, string vcsa, string hcxCloudManager) + { + NsxtManager = nsxtManager; + Vcsa = vcsa; + HcxCloudManager = hcxCloudManager; + } + + /// Endpoint for the NSX-T Data Center manager. + public string NsxtManager { get; } + /// Endpoint for Virtual Center Server Appliance. + public string Vcsa { get; } + /// Endpoint for the HCX Cloud Manager. + public string HcxCloudManager { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs new file mode 100644 index 000000000000..a717cc263ee4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class ExpressRouteAuthorizationData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(ExpressRouteId)) + { + writer.WritePropertyName("expressRouteId"); + writer.WriteStringValue(ExpressRouteId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ExpressRouteAuthorizationData DeserializeExpressRouteAuthorizationData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional provisioningState = default; + Optional expressRouteAuthorizationId = default; + Optional expressRouteAuthorizationKey = default; + Optional expressRouteId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new ExpressRouteAuthorizationProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("expressRouteAuthorizationId")) + { + expressRouteAuthorizationId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("expressRouteAuthorizationKey")) + { + expressRouteAuthorizationKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("expressRouteId")) + { + expressRouteId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ExpressRouteAuthorizationData(id, name, type, Optional.ToNullable(provisioningState), expressRouteAuthorizationId.Value, expressRouteAuthorizationKey.Value, expressRouteId.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.Serialization.cs new file mode 100644 index 000000000000..aebfb4eb4c19 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class ExpressRouteAuthorizationList + { + internal static ExpressRouteAuthorizationList DeserializeExpressRouteAuthorizationList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ExpressRouteAuthorizationList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.cs new file mode 100644 index 000000000000..79a226b87dcf --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A paged list of ExpressRoute Circuit Authorizations. + internal partial class ExpressRouteAuthorizationList + { + /// Initializes a new instance of ExpressRouteAuthorizationList. + internal ExpressRouteAuthorizationList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ExpressRouteAuthorizationList. + /// The items on a page. + /// URL to get the next page if any. + internal ExpressRouteAuthorizationList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on a page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationProvisioningState.cs new file mode 100644 index 000000000000..7e6daad34949 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The state of the ExpressRoute Circuit Authorization provisioning. + public readonly partial struct ExpressRouteAuthorizationProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ExpressRouteAuthorizationProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static ExpressRouteAuthorizationProvisioningState Succeeded { get; } = new ExpressRouteAuthorizationProvisioningState(SucceededValue); + /// Failed. + public static ExpressRouteAuthorizationProvisioningState Failed { get; } = new ExpressRouteAuthorizationProvisioningState(FailedValue); + /// Updating. + public static ExpressRouteAuthorizationProvisioningState Updating { get; } = new ExpressRouteAuthorizationProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(ExpressRouteAuthorizationProvisioningState left, ExpressRouteAuthorizationProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ExpressRouteAuthorizationProvisioningState left, ExpressRouteAuthorizationProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ExpressRouteAuthorizationProvisioningState(string value) => new ExpressRouteAuthorizationProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ExpressRouteAuthorizationProvisioningState other && Equals(other); + /// + public bool Equals(ExpressRouteAuthorizationProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs new file mode 100644 index 000000000000..dddbac1518ff --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class GlobalReachConnectionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(AuthorizationKey)) + { + writer.WritePropertyName("authorizationKey"); + writer.WriteStringValue(AuthorizationKey); + } + if (Optional.IsDefined(PeerExpressRouteCircuit)) + { + writer.WritePropertyName("peerExpressRouteCircuit"); + writer.WriteStringValue(PeerExpressRouteCircuit); + } + if (Optional.IsDefined(ExpressRouteId)) + { + writer.WritePropertyName("expressRouteId"); + writer.WriteStringValue(ExpressRouteId); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static GlobalReachConnectionData DeserializeGlobalReachConnectionData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional provisioningState = default; + Optional addressPrefix = default; + Optional authorizationKey = default; + Optional circuitConnectionStatus = default; + Optional peerExpressRouteCircuit = default; + Optional expressRouteId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new GlobalReachConnectionProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("addressPrefix")) + { + addressPrefix = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("authorizationKey")) + { + authorizationKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("circuitConnectionStatus")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + circuitConnectionStatus = new GlobalReachConnectionStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("peerExpressRouteCircuit")) + { + peerExpressRouteCircuit = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("expressRouteId")) + { + expressRouteId = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new GlobalReachConnectionData(id, name, type, Optional.ToNullable(provisioningState), addressPrefix.Value, authorizationKey.Value, Optional.ToNullable(circuitConnectionStatus), peerExpressRouteCircuit.Value, expressRouteId.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.Serialization.cs new file mode 100644 index 000000000000..70137d053921 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class GlobalReachConnectionList + { + internal static GlobalReachConnectionList DeserializeGlobalReachConnectionList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GlobalReachConnectionData.DeserializeGlobalReachConnectionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new GlobalReachConnectionList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.cs new file mode 100644 index 000000000000..22696ce39f9b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A paged list of global reach connections. + internal partial class GlobalReachConnectionList + { + /// Initializes a new instance of GlobalReachConnectionList. + internal GlobalReachConnectionList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of GlobalReachConnectionList. + /// The items on a page. + /// URL to get the next page if any. + internal GlobalReachConnectionList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on a page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionProvisioningState.cs new file mode 100644 index 000000000000..b94875220b42 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The state of the ExpressRoute Circuit Authorization provisioning. + public readonly partial struct GlobalReachConnectionProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GlobalReachConnectionProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static GlobalReachConnectionProvisioningState Succeeded { get; } = new GlobalReachConnectionProvisioningState(SucceededValue); + /// Failed. + public static GlobalReachConnectionProvisioningState Failed { get; } = new GlobalReachConnectionProvisioningState(FailedValue); + /// Updating. + public static GlobalReachConnectionProvisioningState Updating { get; } = new GlobalReachConnectionProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(GlobalReachConnectionProvisioningState left, GlobalReachConnectionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GlobalReachConnectionProvisioningState left, GlobalReachConnectionProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator GlobalReachConnectionProvisioningState(string value) => new GlobalReachConnectionProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GlobalReachConnectionProvisioningState other && Equals(other); + /// + public bool Equals(GlobalReachConnectionProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionStatus.cs new file mode 100644 index 000000000000..b04437bc8ecd --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionStatus.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The connection status of the global reach connection. + public readonly partial struct GlobalReachConnectionStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GlobalReachConnectionStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConnectedValue = "Connected"; + private const string ConnectingValue = "Connecting"; + private const string DisconnectedValue = "Disconnected"; + + /// Connected. + public static GlobalReachConnectionStatus Connected { get; } = new GlobalReachConnectionStatus(ConnectedValue); + /// Connecting. + public static GlobalReachConnectionStatus Connecting { get; } = new GlobalReachConnectionStatus(ConnectingValue); + /// Disconnected. + public static GlobalReachConnectionStatus Disconnected { get; } = new GlobalReachConnectionStatus(DisconnectedValue); + /// Determines if two values are the same. + public static bool operator ==(GlobalReachConnectionStatus left, GlobalReachConnectionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GlobalReachConnectionStatus left, GlobalReachConnectionStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator GlobalReachConnectionStatus(string value) => new GlobalReachConnectionStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GlobalReachConnectionStatus other && Equals(other); + /// + public bool Equals(GlobalReachConnectionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs new file mode 100644 index 000000000000..30abfd244d4c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class HcxEnterpriseSiteData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static HcxEnterpriseSiteData DeserializeHcxEnterpriseSiteData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional activationKey = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("activationKey")) + { + activationKey = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("status")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new HcxEnterpriseSiteStatus(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new HcxEnterpriseSiteData(id, name, type, activationKey.Value, Optional.ToNullable(status)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.Serialization.cs new file mode 100644 index 000000000000..22d239fb88a0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class HcxEnterpriseSiteList + { + internal static HcxEnterpriseSiteList DeserializeHcxEnterpriseSiteList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HcxEnterpriseSiteData.DeserializeHcxEnterpriseSiteData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new HcxEnterpriseSiteList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.cs new file mode 100644 index 000000000000..5932fc66d6f4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A paged list of HCX Enterprise Sites. + internal partial class HcxEnterpriseSiteList + { + /// Initializes a new instance of HcxEnterpriseSiteList. + internal HcxEnterpriseSiteList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of HcxEnterpriseSiteList. + /// The items on a page. + /// URL to get the next page if any. + internal HcxEnterpriseSiteList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on a page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteStatus.cs new file mode 100644 index 000000000000..b5c2131ec4b2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The status of the HCX Enterprise Site. + public readonly partial struct HcxEnterpriseSiteStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HcxEnterpriseSiteStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AvailableValue = "Available"; + private const string ConsumedValue = "Consumed"; + private const string DeactivatedValue = "Deactivated"; + private const string DeletedValue = "Deleted"; + + /// Available. + public static HcxEnterpriseSiteStatus Available { get; } = new HcxEnterpriseSiteStatus(AvailableValue); + /// Consumed. + public static HcxEnterpriseSiteStatus Consumed { get; } = new HcxEnterpriseSiteStatus(ConsumedValue); + /// Deactivated. + public static HcxEnterpriseSiteStatus Deactivated { get; } = new HcxEnterpriseSiteStatus(DeactivatedValue); + /// Deleted. + public static HcxEnterpriseSiteStatus Deleted { get; } = new HcxEnterpriseSiteStatus(DeletedValue); + /// Determines if two values are the same. + public static bool operator ==(HcxEnterpriseSiteStatus left, HcxEnterpriseSiteStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HcxEnterpriseSiteStatus left, HcxEnterpriseSiteStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator HcxEnterpriseSiteStatus(string value) => new HcxEnterpriseSiteStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HcxEnterpriseSiteStatus other && Equals(other); + /// + public bool Equals(HcxEnterpriseSiteStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.Serialization.cs new file mode 100644 index 000000000000..f98d170a926d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class IdentitySource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Alias)) + { + writer.WritePropertyName("alias"); + writer.WriteStringValue(Alias); + } + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"); + writer.WriteStringValue(Domain); + } + if (Optional.IsDefined(BaseUserDN)) + { + writer.WritePropertyName("baseUserDN"); + writer.WriteStringValue(BaseUserDN); + } + if (Optional.IsDefined(BaseGroupDN)) + { + writer.WritePropertyName("baseGroupDN"); + writer.WriteStringValue(BaseGroupDN); + } + if (Optional.IsDefined(PrimaryServer)) + { + writer.WritePropertyName("primaryServer"); + writer.WriteStringValue(PrimaryServer); + } + if (Optional.IsDefined(SecondaryServer)) + { + writer.WritePropertyName("secondaryServer"); + writer.WriteStringValue(SecondaryServer); + } + if (Optional.IsDefined(Ssl)) + { + writer.WritePropertyName("ssl"); + writer.WriteStringValue(Ssl.Value.ToString()); + } + if (Optional.IsDefined(Username)) + { + writer.WritePropertyName("username"); + writer.WriteStringValue(Username); + } + if (Optional.IsDefined(Password)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(Password); + } + writer.WriteEndObject(); + } + + internal static IdentitySource DeserializeIdentitySource(JsonElement element) + { + Optional name = default; + Optional @alias = default; + Optional domain = default; + Optional baseUserDN = default; + Optional baseGroupDN = default; + Optional primaryServer = default; + Optional secondaryServer = default; + Optional ssl = default; + Optional username = default; + Optional password = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("alias")) + { + @alias = property.Value.GetString(); + continue; + } + if (property.NameEquals("domain")) + { + domain = property.Value.GetString(); + continue; + } + if (property.NameEquals("baseUserDN")) + { + baseUserDN = property.Value.GetString(); + continue; + } + if (property.NameEquals("baseGroupDN")) + { + baseGroupDN = property.Value.GetString(); + continue; + } + if (property.NameEquals("primaryServer")) + { + primaryServer = property.Value.GetString(); + continue; + } + if (property.NameEquals("secondaryServer")) + { + secondaryServer = property.Value.GetString(); + continue; + } + if (property.NameEquals("ssl")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + ssl = new SslEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("username")) + { + username = property.Value.GetString(); + continue; + } + if (property.NameEquals("password")) + { + password = property.Value.GetString(); + continue; + } + } + return new IdentitySource(name.Value, @alias.Value, domain.Value, baseUserDN.Value, baseGroupDN.Value, primaryServer.Value, secondaryServer.Value, Optional.ToNullable(ssl), username.Value, password.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.cs new file mode 100644 index 000000000000..7aba4e3133b9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/IdentitySource.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// vCenter Single Sign On Identity Source. + public partial class IdentitySource + { + /// Initializes a new instance of IdentitySource. + public IdentitySource() + { + } + + /// Initializes a new instance of IdentitySource. + /// The name of the identity source. + /// The domain's NetBIOS name. + /// The domain's dns name. + /// The base distinguished name for users. + /// The base distinguished name for groups. + /// Primary server URL. + /// Secondary server URL. + /// Protect LDAP communication using SSL certificate (LDAPS). + /// The ID of an Active Directory user with a minimum of read-only access to Base DN for users and group. + /// The password of the Active Directory user with a minimum of read-only access to Base DN for users and groups. + internal IdentitySource(string name, string @alias, string domain, string baseUserDN, string baseGroupDN, string primaryServer, string secondaryServer, SslEnum? ssl, string username, string password) + { + Name = name; + Alias = @alias; + Domain = domain; + BaseUserDN = baseUserDN; + BaseGroupDN = baseGroupDN; + PrimaryServer = primaryServer; + SecondaryServer = secondaryServer; + Ssl = ssl; + Username = username; + Password = password; + } + + /// The name of the identity source. + public string Name { get; set; } + /// The domain's NetBIOS name. + public string Alias { get; set; } + /// The domain's dns name. + public string Domain { get; set; } + /// The base distinguished name for users. + public string BaseUserDN { get; set; } + /// The base distinguished name for groups. + public string BaseGroupDN { get; set; } + /// Primary server URL. + public string PrimaryServer { get; set; } + /// Secondary server URL. + public string SecondaryServer { get; set; } + /// Protect LDAP communication using SSL certificate (LDAPS). + public SslEnum? Ssl { get; set; } + /// The ID of an Active Directory user with a minimum of read-only access to Base DN for users and group. + public string Username { get; set; } + /// The password of the Active Directory user with a minimum of read-only access to Base DN for users and groups. + public string Password { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/InternetEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/InternetEnum.cs new file mode 100644 index 000000000000..5f6ba06ca0a7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/InternetEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Connectivity to internet is enabled or disabled. + public readonly partial struct InternetEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public InternetEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static InternetEnum Enabled { get; } = new InternetEnum(EnabledValue); + /// Disabled. + public static InternetEnum Disabled { get; } = new InternetEnum(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(InternetEnum left, InternetEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InternetEnum left, InternetEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator InternetEnum(string value) => new InternetEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InternetEnum other && Equals(other); + /// + public bool Equals(InternetEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.Serialization.cs new file mode 100644 index 000000000000..380a76049fbb --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.Serialization.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class ManagementCluster : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ClusterSize)) + { + writer.WritePropertyName("clusterSize"); + writer.WriteNumberValue(ClusterSize.Value); + } + if (Optional.IsCollectionDefined(Hosts)) + { + writer.WritePropertyName("hosts"); + writer.WriteStartArray(); + foreach (var item in Hosts) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static ManagementCluster DeserializeManagementCluster(JsonElement element) + { + Optional clusterSize = default; + Optional provisioningState = default; + Optional clusterId = default; + Optional> hosts = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clusterSize")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + clusterSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new ClusterProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("clusterId")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + clusterId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("hosts")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + hosts = array; + continue; + } + } + return new ManagementCluster(Optional.ToNullable(clusterSize), Optional.ToNullable(provisioningState), Optional.ToNullable(clusterId), Optional.ToList(hosts)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.cs new file mode 100644 index 000000000000..04f9df6a9f4d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ManagementCluster.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a management cluster. + public partial class ManagementCluster : CommonClusterProperties + { + /// Initializes a new instance of ManagementCluster. + public ManagementCluster() + { + } + + /// Initializes a new instance of ManagementCluster. + /// The cluster size. + /// The state of the cluster provisioning. + /// The identity. + /// The hosts. + internal ManagementCluster(int? clusterSize, ClusterProvisioningState? provisioningState, int? clusterId, IList hosts) : base(clusterSize, provisioningState, clusterId, hosts) + { + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/MountOptionEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/MountOptionEnum.cs new file mode 100644 index 000000000000..216f9f97f58c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/MountOptionEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN. + public readonly partial struct MountOptionEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MountOptionEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MountValue = "MOUNT"; + private const string AttachValue = "ATTACH"; + + /// MOUNT. + public static MountOptionEnum Mount { get; } = new MountOptionEnum(MountValue); + /// ATTACH. + public static MountOptionEnum Attach { get; } = new MountOptionEnum(AttachValue); + /// Determines if two values are the same. + public static bool operator ==(MountOptionEnum left, MountOptionEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MountOptionEnum left, MountOptionEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator MountOptionEnum(string value) => new MountOptionEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MountOptionEnum other && Equals(other); + /// + public bool Equals(MountOptionEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/OptionalParamEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/OptionalParamEnum.cs new file mode 100644 index 000000000000..166d560812e1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/OptionalParamEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Is this parameter required or optional. + public readonly partial struct OptionalParamEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OptionalParamEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OptionalValue = "Optional"; + private const string RequiredValue = "Required"; + + /// Optional. + public static OptionalParamEnum Optional { get; } = new OptionalParamEnum(OptionalValue); + /// Required. + public static OptionalParamEnum Required { get; } = new OptionalParamEnum(RequiredValue); + /// Determines if two values are the same. + public static bool operator ==(OptionalParamEnum left, OptionalParamEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OptionalParamEnum left, OptionalParamEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator OptionalParamEnum(string value) => new OptionalParamEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OptionalParamEnum other && Equals(other); + /// + public bool Equals(OptionalParamEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.Serialization.cs new file mode 100644 index 000000000000..367c8c96d7e9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class PSCredentialExecutionParameter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Username)) + { + writer.WritePropertyName("username"); + writer.WriteStringValue(Username); + } + if (Optional.IsDefined(Password)) + { + writer.WritePropertyName("password"); + writer.WriteStringValue(Password); + } + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.ToString()); + writer.WriteEndObject(); + } + + internal static PSCredentialExecutionParameter DeserializePSCredentialExecutionParameter(JsonElement element) + { + Optional username = default; + Optional password = default; + string name = default; + ScriptExecutionParameterType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("username")) + { + username = property.Value.GetString(); + continue; + } + if (property.NameEquals("password")) + { + password = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new ScriptExecutionParameterType(property.Value.GetString()); + continue; + } + } + return new PSCredentialExecutionParameter(name, type, username.Value, password.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.cs new file mode 100644 index 000000000000..e81a6aa4f7de --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PSCredentialExecutionParameter.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Avs.Models +{ + /// a powershell credential object. + public partial class PSCredentialExecutionParameter : ScriptExecutionParameter + { + /// Initializes a new instance of PSCredentialExecutionParameter. + /// The parameter name. + /// is null. + public PSCredentialExecutionParameter(string name) : base(name) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Type = ScriptExecutionParameterType.Credential; + } + + /// Initializes a new instance of PSCredentialExecutionParameter. + /// The parameter name. + /// The type of execution parameter. + /// username for login. + /// password for login. + internal PSCredentialExecutionParameter(string name, ScriptExecutionParameterType type, string username, string password) : base(name, type) + { + Username = username; + Password = password; + Type = type; + } + + /// username for login. + public string Username { get; set; } + /// password for login. + public string Password { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.Serialization.cs new file mode 100644 index 000000000000..472a3d629169 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class PlacementPoliciesList + { + internal static PlacementPoliciesList DeserializePlacementPoliciesList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PlacementPolicyData.DeserializePlacementPolicyData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PlacementPoliciesList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.cs new file mode 100644 index 000000000000..55965a14c506 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPoliciesList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Represents list of placement policies. + internal partial class PlacementPoliciesList + { + /// Initializes a new instance of PlacementPoliciesList. + internal PlacementPoliciesList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PlacementPoliciesList. + /// The items on the page. + /// URL to get the next page if any. + internal PlacementPoliciesList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs new file mode 100644 index 000000000000..56dda8283cf6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class PlacementPolicyData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static PlacementPolicyData DeserializePlacementPolicyData(JsonElement element) + { + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = PlacementPolicyProperties.DeserializePlacementPolicyProperties(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new PlacementPolicyData(id, name, type, properties.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs new file mode 100644 index 000000000000..7eea61c4681d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.Serialization.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class PlacementPolicyProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.ToString()); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + writer.WriteEndObject(); + } + + internal static PlacementPolicyProperties DeserializePlacementPolicyProperties(JsonElement element) + { + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "VmHost": return VmHostPlacementPolicyProperties.DeserializeVmHostPlacementPolicyProperties(element); + case "VmVm": return VmPlacementPolicyProperties.DeserializeVmPlacementPolicyProperties(element); + } + } + PlacementPolicyType type = default; + Optional state = default; + Optional displayName = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + type = new PlacementPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("state")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + state = new PlacementPolicyState(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName")) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new PlacementPolicyProvisioningState(property.Value.GetString()); + continue; + } + } + return new PlacementPolicyProperties(type, Optional.ToNullable(state), displayName.Value, Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs new file mode 100644 index 000000000000..6976913f2076 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProperties.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// Abstract placement policy properties. + public partial class PlacementPolicyProperties + { + /// Initializes a new instance of PlacementPolicyProperties. + public PlacementPolicyProperties() + { + } + + /// Initializes a new instance of PlacementPolicyProperties. + /// placement policy type. + /// Whether the placement policy is enabled or disabled. + /// Display name of the placement policy. + /// The provisioning state. + internal PlacementPolicyProperties(PlacementPolicyType type, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState) + { + Type = type; + State = state; + DisplayName = displayName; + ProvisioningState = provisioningState; + } + + /// placement policy type. + internal PlacementPolicyType Type { get; set; } + /// Whether the placement policy is enabled or disabled. + public PlacementPolicyState? State { get; set; } + /// Display name of the placement policy. + public string DisplayName { get; set; } + /// The provisioning state. + public PlacementPolicyProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProvisioningState.cs new file mode 100644 index 000000000000..207c07af3bbf --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The provisioning state. + public readonly partial struct PlacementPolicyProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PlacementPolicyProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static PlacementPolicyProvisioningState Succeeded { get; } = new PlacementPolicyProvisioningState(SucceededValue); + /// Failed. + public static PlacementPolicyProvisioningState Failed { get; } = new PlacementPolicyProvisioningState(FailedValue); + /// Building. + public static PlacementPolicyProvisioningState Building { get; } = new PlacementPolicyProvisioningState(BuildingValue); + /// Deleting. + public static PlacementPolicyProvisioningState Deleting { get; } = new PlacementPolicyProvisioningState(DeletingValue); + /// Updating. + public static PlacementPolicyProvisioningState Updating { get; } = new PlacementPolicyProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(PlacementPolicyProvisioningState left, PlacementPolicyProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PlacementPolicyProvisioningState left, PlacementPolicyProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PlacementPolicyProvisioningState(string value) => new PlacementPolicyProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PlacementPolicyProvisioningState other && Equals(other); + /// + public bool Equals(PlacementPolicyProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyState.cs new file mode 100644 index 000000000000..add56af65eed --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Whether the placement policy is enabled or disabled. + public readonly partial struct PlacementPolicyState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PlacementPolicyState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static PlacementPolicyState Enabled { get; } = new PlacementPolicyState(EnabledValue); + /// Disabled. + public static PlacementPolicyState Disabled { get; } = new PlacementPolicyState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(PlacementPolicyState left, PlacementPolicyState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PlacementPolicyState left, PlacementPolicyState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PlacementPolicyState(string value) => new PlacementPolicyState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PlacementPolicyState other && Equals(other); + /// + public bool Equals(PlacementPolicyState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyType.cs new file mode 100644 index 000000000000..2cecf48ec610 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// placement policy type. + public readonly partial struct PlacementPolicyType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PlacementPolicyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string VmVmValue = "VmVm"; + private const string VmHostValue = "VmHost"; + + /// VmVm. + public static PlacementPolicyType VmVm { get; } = new PlacementPolicyType(VmVmValue); + /// VmHost. + public static PlacementPolicyType VmHost { get; } = new PlacementPolicyType(VmHostValue); + /// Determines if two values are the same. + public static bool operator ==(PlacementPolicyType left, PlacementPolicyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PlacementPolicyType left, PlacementPolicyType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PlacementPolicyType(string value) => new PlacementPolicyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PlacementPolicyType other && Equals(other); + /// + public bool Equals(PlacementPolicyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyUpdate.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyUpdate.Serialization.cs new file mode 100644 index 000000000000..7387e3e3b41e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyUpdate.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class PlacementPolicyUpdate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsCollectionDefined(VmMembers)) + { + writer.WritePropertyName("vmMembers"); + writer.WriteStartArray(); + foreach (var item in VmMembers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(HostMembers)) + { + writer.WritePropertyName("hostMembers"); + writer.WriteStartArray(); + foreach (var item in HostMembers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyUpdate.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyUpdate.cs new file mode 100644 index 000000000000..eb9d55854a30 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyUpdate.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// An update of a DRS placement policy resource. + public partial class PlacementPolicyUpdate + { + /// Initializes a new instance of PlacementPolicyUpdate. + public PlacementPolicyUpdate() + { + VmMembers = new ChangeTrackingList(); + HostMembers = new ChangeTrackingList(); + } + + /// Whether the placement policy is enabled or disabled. + public PlacementPolicyState? State { get; set; } + /// Virtual machine members list. + public IList VmMembers { get; } + /// Host members list. + public IList HostMembers { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs new file mode 100644 index 000000000000..d46529958f52 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringDirectionEnum.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Direction of port mirroring profile. + public readonly partial struct PortMirroringDirectionEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PortMirroringDirectionEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IngressValue = "INGRESS"; + private const string EgressValue = "EGRESS"; + private const string BidirectionalValue = "BIDIRECTIONAL"; + + /// INGRESS. + public static PortMirroringDirectionEnum Ingress { get; } = new PortMirroringDirectionEnum(IngressValue); + /// EGRESS. + public static PortMirroringDirectionEnum Egress { get; } = new PortMirroringDirectionEnum(EgressValue); + /// BIDIRECTIONAL. + public static PortMirroringDirectionEnum Bidirectional { get; } = new PortMirroringDirectionEnum(BidirectionalValue); + /// Determines if two values are the same. + public static bool operator ==(PortMirroringDirectionEnum left, PortMirroringDirectionEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PortMirroringDirectionEnum left, PortMirroringDirectionEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PortMirroringDirectionEnum(string value) => new PortMirroringDirectionEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PortMirroringDirectionEnum other && Equals(other); + /// + public bool Equals(PortMirroringDirectionEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringStatusEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringStatusEnum.cs new file mode 100644 index 000000000000..6e4f2a8ffe6c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PortMirroringStatusEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Port Mirroring Status. + public readonly partial struct PortMirroringStatusEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PortMirroringStatusEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SuccessValue = "SUCCESS"; + private const string FailureValue = "FAILURE"; + + /// SUCCESS. + public static PortMirroringStatusEnum Success { get; } = new PortMirroringStatusEnum(SuccessValue); + /// FAILURE. + public static PortMirroringStatusEnum Failure { get; } = new PortMirroringStatusEnum(FailureValue); + /// Determines if two values are the same. + public static bool operator ==(PortMirroringStatusEnum left, PortMirroringStatusEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PortMirroringStatusEnum left, PortMirroringStatusEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PortMirroringStatusEnum(string value) => new PortMirroringStatusEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PortMirroringStatusEnum other && Equals(other); + /// + public bool Equals(PortMirroringStatusEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudData.Serialization.cs new file mode 100644 index 000000000000..b1151a5bc33b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudData.Serialization.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class PrivateCloudData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("sku"); + writer.WriteObjectValue(Sku); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(ManagementCluster)) + { + writer.WritePropertyName("managementCluster"); + writer.WriteObjectValue(ManagementCluster); + } + if (Optional.IsDefined(Internet)) + { + writer.WritePropertyName("internet"); + writer.WriteStringValue(Internet.Value.ToString()); + } + if (Optional.IsCollectionDefined(IdentitySources)) + { + writer.WritePropertyName("identitySources"); + writer.WriteStartArray(); + foreach (var item in IdentitySources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Availability)) + { + writer.WritePropertyName("availability"); + writer.WriteObjectValue(Availability); + } + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"); + writer.WriteObjectValue(Encryption); + } + if (Optional.IsDefined(Circuit)) + { + writer.WritePropertyName("circuit"); + writer.WriteObjectValue(Circuit); + } + if (Optional.IsDefined(NetworkBlock)) + { + writer.WritePropertyName("networkBlock"); + writer.WriteStringValue(NetworkBlock); + } + if (Optional.IsDefined(VcenterPassword)) + { + writer.WritePropertyName("vcenterPassword"); + writer.WriteStringValue(VcenterPassword); + } + if (Optional.IsDefined(NsxtPassword)) + { + writer.WritePropertyName("nsxtPassword"); + writer.WriteStringValue(NsxtPassword); + } + if (Optional.IsDefined(SecondaryCircuit)) + { + writer.WritePropertyName("secondaryCircuit"); + writer.WriteObjectValue(SecondaryCircuit); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static PrivateCloudData DeserializePrivateCloudData(JsonElement element) + { + Sku sku = default; + Optional identity = default; + IDictionary tags = default; + Location location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional managementCluster = default; + Optional internet = default; + Optional> identitySources = default; + Optional availability = default; + Optional encryption = default; + Optional provisioningState = default; + Optional circuit = default; + Optional endpoints = default; + Optional networkBlock = default; + Optional managementNetwork = default; + Optional provisioningNetwork = default; + Optional vmotionNetwork = default; + Optional vcenterPassword = default; + Optional nsxtPassword = default; + Optional vcenterCertificateThumbprint = default; + Optional nsxtCertificateThumbprint = default; + Optional> externalCloudLinks = default; + Optional secondaryCircuit = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku")) + { + sku = Sku.DeserializeSku(property.Value); + continue; + } + if (property.NameEquals("identity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + identity = PrivateCloudIdentity.DeserializePrivateCloudIdentity(property.Value); + continue; + } + if (property.NameEquals("tags")) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location")) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("managementCluster")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + managementCluster = ManagementCluster.DeserializeManagementCluster(property0.Value); + continue; + } + if (property0.NameEquals("internet")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + internet = new InternetEnum(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("identitySources")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(IdentitySource.DeserializeIdentitySource(item)); + } + identitySources = array; + continue; + } + if (property0.NameEquals("availability")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + availability = AvailabilityProperties.DeserializeAvailabilityProperties(property0.Value); + continue; + } + if (property0.NameEquals("encryption")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + encryption = Encryption.DeserializeEncryption(property0.Value); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new PrivateCloudProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("circuit")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + circuit = Circuit.DeserializeCircuit(property0.Value); + continue; + } + if (property0.NameEquals("endpoints")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + endpoints = Endpoints.DeserializeEndpoints(property0.Value); + continue; + } + if (property0.NameEquals("networkBlock")) + { + networkBlock = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("managementNetwork")) + { + managementNetwork = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningNetwork")) + { + provisioningNetwork = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmotionNetwork")) + { + vmotionNetwork = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vcenterPassword")) + { + vcenterPassword = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("nsxtPassword")) + { + nsxtPassword = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vcenterCertificateThumbprint")) + { + vcenterCertificateThumbprint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("nsxtCertificateThumbprint")) + { + nsxtCertificateThumbprint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("externalCloudLinks")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + externalCloudLinks = array; + continue; + } + if (property0.NameEquals("secondaryCircuit")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + secondaryCircuit = Circuit.DeserializeCircuit(property0.Value); + continue; + } + } + continue; + } + } + return new PrivateCloudData(id, name, type, tags, location, sku, identity.Value, managementCluster.Value, Optional.ToNullable(internet), Optional.ToList(identitySources), availability.Value, encryption.Value, Optional.ToNullable(provisioningState), circuit.Value, endpoints.Value, networkBlock.Value, managementNetwork.Value, provisioningNetwork.Value, vmotionNetwork.Value, vcenterPassword.Value, nsxtPassword.Value, vcenterCertificateThumbprint.Value, nsxtCertificateThumbprint.Value, Optional.ToList(externalCloudLinks), secondaryCircuit.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudIdentity.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudIdentity.Serialization.cs new file mode 100644 index 000000000000..40db1348b471 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudIdentity.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class PrivateCloudIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static PrivateCloudIdentity DeserializePrivateCloudIdentity(JsonElement element) + { + Optional principalId = default; + Optional tenantId = default; + Optional type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId")) + { + principalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId")) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = new ResourceIdentityType(property.Value.GetString()); + continue; + } + } + return new PrivateCloudIdentity(principalId.Value, tenantId.Value, Optional.ToNullable(type)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudIdentity.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudIdentity.cs new file mode 100644 index 000000000000..359e49d7e9e6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudIdentity.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// Identity for the virtual machine. + public partial class PrivateCloudIdentity + { + /// Initializes a new instance of PrivateCloudIdentity. + public PrivateCloudIdentity() + { + } + + /// Initializes a new instance of PrivateCloudIdentity. + /// The principal ID of private cloud identity. This property will only be provided for a system assigned identity. + /// The tenant ID associated with the private cloud. This property will only be provided for a system assigned identity. + /// The type of identity used for the private cloud. The type 'SystemAssigned' refers to an implicitly created identity. The type 'None' will remove any identities from the Private Cloud. + internal PrivateCloudIdentity(string principalId, string tenantId, ResourceIdentityType? type) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + } + + /// The principal ID of private cloud identity. This property will only be provided for a system assigned identity. + public string PrincipalId { get; } + /// The tenant ID associated with the private cloud. This property will only be provided for a system assigned identity. + public string TenantId { get; } + /// The type of identity used for the private cloud. The type 'SystemAssigned' refers to an implicitly created identity. The type 'None' will remove any identities from the Private Cloud. + public ResourceIdentityType? Type { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs new file mode 100644 index 000000000000..ed46cb3a904e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class PrivateCloudList + { + internal static PrivateCloudList DeserializePrivateCloudList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PrivateCloudData.DeserializePrivateCloudData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new PrivateCloudList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs new file mode 100644 index 000000000000..468f874fb587 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A paged list of private clouds. + internal partial class PrivateCloudList + { + /// Initializes a new instance of PrivateCloudList. + internal PrivateCloudList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of PrivateCloudList. + /// The items on the page. + /// URL to get the next page if any. + internal PrivateCloudList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.Serialization.cs new file mode 100644 index 000000000000..03bd032b20f7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.Serialization.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class PrivateCloudProperties + { + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.cs new file mode 100644 index 000000000000..98d6792c310c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProperties.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a private cloud resource. + internal partial class PrivateCloudProperties : PrivateCloudUpdateProperties + { + /// Initializes a new instance of PrivateCloudProperties. + /// The block of addresses should be unique across VNet in your subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are between 0 and 255, and X is between 0 and 22. + /// is null. + internal PrivateCloudProperties(string networkBlock) + { + if (networkBlock == null) + { + throw new ArgumentNullException(nameof(networkBlock)); + } + + NetworkBlock = networkBlock; + ExternalCloudLinks = new ChangeTrackingList(); + } + + /// The provisioning state. + public PrivateCloudProvisioningState? ProvisioningState { get; } + /// An ExpressRoute Circuit. + public Circuit Circuit { get; } + /// The endpoints. + public Endpoints Endpoints { get; } + /// The block of addresses should be unique across VNet in your subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are between 0 and 255, and X is between 0 and 22. + public string NetworkBlock { get; } + /// Network used to access vCenter Server and NSX-T Manager. + public string ManagementNetwork { get; } + /// Used for virtual machine cold migration, cloning, and snapshot migration. + public string ProvisioningNetwork { get; } + /// Used for live migration of virtual machines. + public string VmotionNetwork { get; } + /// Optionally, set the vCenter admin password when the private cloud is created. + public string VcenterPassword { get; } + /// Optionally, set the NSX-T Manager password when the private cloud is created. + public string NsxtPassword { get; } + /// Thumbprint of the vCenter Server SSL certificate. + public string VcenterCertificateThumbprint { get; } + /// Thumbprint of the NSX-T Manager SSL certificate. + public string NsxtCertificateThumbprint { get; } + /// Array of cloud link IDs from other clouds that connect to this one. + public IReadOnlyList ExternalCloudLinks { get; } + /// A secondary expressRoute circuit from a separate AZ. Only present in a stretched private cloud. + public Circuit SecondaryCircuit { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProvisioningState.cs new file mode 100644 index 000000000000..aaa7e4e2b798 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The provisioning state. + public readonly partial struct PrivateCloudProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PrivateCloudProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CancelledValue = "Cancelled"; + private const string PendingValue = "Pending"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static PrivateCloudProvisioningState Succeeded { get; } = new PrivateCloudProvisioningState(SucceededValue); + /// Failed. + public static PrivateCloudProvisioningState Failed { get; } = new PrivateCloudProvisioningState(FailedValue); + /// Cancelled. + public static PrivateCloudProvisioningState Cancelled { get; } = new PrivateCloudProvisioningState(CancelledValue); + /// Pending. + public static PrivateCloudProvisioningState Pending { get; } = new PrivateCloudProvisioningState(PendingValue); + /// Building. + public static PrivateCloudProvisioningState Building { get; } = new PrivateCloudProvisioningState(BuildingValue); + /// Deleting. + public static PrivateCloudProvisioningState Deleting { get; } = new PrivateCloudProvisioningState(DeletingValue); + /// Updating. + public static PrivateCloudProvisioningState Updating { get; } = new PrivateCloudProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(PrivateCloudProvisioningState left, PrivateCloudProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PrivateCloudProvisioningState left, PrivateCloudProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PrivateCloudProvisioningState(string value) => new PrivateCloudProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PrivateCloudProvisioningState other && Equals(other); + /// + public bool Equals(PrivateCloudProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdate.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdate.Serialization.cs new file mode 100644 index 000000000000..92186bb1f865 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdate.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class PrivateCloudUpdate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"); + writer.WriteObjectValue(Identity); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(ManagementCluster)) + { + writer.WritePropertyName("managementCluster"); + writer.WriteObjectValue(ManagementCluster); + } + if (Optional.IsDefined(Internet)) + { + writer.WritePropertyName("internet"); + writer.WriteStringValue(Internet.Value.ToString()); + } + if (Optional.IsCollectionDefined(IdentitySources)) + { + writer.WritePropertyName("identitySources"); + writer.WriteStartArray(); + foreach (var item in IdentitySources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Availability)) + { + writer.WritePropertyName("availability"); + writer.WriteObjectValue(Availability); + } + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"); + writer.WriteObjectValue(Encryption); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdate.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdate.cs new file mode 100644 index 000000000000..80793914fe10 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdate.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// An update to a private cloud resource. + public partial class PrivateCloudUpdate + { + /// Initializes a new instance of PrivateCloudUpdate. + public PrivateCloudUpdate() + { + Tags = new ChangeTrackingDictionary(); + IdentitySources = new ChangeTrackingList(); + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The identity of the private cloud, if configured. + public PrivateCloudIdentity Identity { get; set; } + /// The default cluster used for management. + public ManagementCluster ManagementCluster { get; set; } + /// Connectivity to internet is enabled or disabled. + public InternetEnum? Internet { get; set; } + /// vCenter Single Sign On Identity Sources. + public IList IdentitySources { get; } + /// Properties describing how the cloud is distributed across availability zones. + public AvailabilityProperties Availability { get; set; } + /// Customer managed key encryption, can be enabled or disabled. + public Encryption Encryption { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdateProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..1226a9cbb409 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdateProperties.Serialization.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class PrivateCloudUpdateProperties + { + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdateProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdateProperties.cs new file mode 100644 index 000000000000..1ec6fff811bc --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudUpdateProperties.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The properties of a private cloud resource that may be updated. + internal partial class PrivateCloudUpdateProperties + { + /// Initializes a new instance of PrivateCloudUpdateProperties. + internal PrivateCloudUpdateProperties() + { + IdentitySources = new ChangeTrackingList(); + } + + /// The default cluster used for management. + public ManagementCluster ManagementCluster { get; } + /// Connectivity to internet is enabled or disabled. + public InternetEnum? Internet { get; } + /// vCenter Single Sign On Identity Sources. + public IReadOnlyList IdentitySources { get; } + /// Properties describing how the cloud is distributed across availability zones. + public AvailabilityProperties Availability { get; } + /// Customer managed key encryption, can be enabled or disabled. + public Encryption Encryption { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.Serialization.cs new file mode 100644 index 000000000000..98683d70d9e3 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class Quota + { + internal static Quota DeserializeQuota(JsonElement element) + { + Optional> hostsRemaining = default; + Optional quotaEnabled = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hostsRemaining")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetInt32()); + } + hostsRemaining = dictionary; + continue; + } + if (property.NameEquals("quotaEnabled")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + quotaEnabled = new QuotaEnabled(property.Value.GetString()); + continue; + } + } + return new Quota(Optional.ToDictionary(hostsRemaining), Optional.ToNullable(quotaEnabled)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.cs new file mode 100644 index 000000000000..85e12ee3b7aa --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Quota.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Subscription quotas. + public partial class Quota + { + /// Initializes a new instance of Quota. + internal Quota() + { + HostsRemaining = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of Quota. + /// Remaining hosts quota by sku type. + /// Host quota is active for current subscription. + internal Quota(IReadOnlyDictionary hostsRemaining, QuotaEnabled? quotaEnabled) + { + HostsRemaining = hostsRemaining; + QuotaEnabled = quotaEnabled; + } + + /// Remaining hosts quota by sku type. + public IReadOnlyDictionary HostsRemaining { get; } + /// Host quota is active for current subscription. + public QuotaEnabled? QuotaEnabled { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/QuotaEnabled.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/QuotaEnabled.cs new file mode 100644 index 000000000000..dc54aeb158a1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/QuotaEnabled.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Host quota is active for current subscription. + public readonly partial struct QuotaEnabled : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public QuotaEnabled(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static QuotaEnabled Enabled { get; } = new QuotaEnabled(EnabledValue); + /// Disabled. + public static QuotaEnabled Disabled { get; } = new QuotaEnabled(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(QuotaEnabled left, QuotaEnabled right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(QuotaEnabled left, QuotaEnabled right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator QuotaEnabled(string value) => new QuotaEnabled(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is QuotaEnabled other && Equals(other); + /// + public bool Equals(QuotaEnabled other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceIdentityType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceIdentityType.cs new file mode 100644 index 000000000000..5a4a428f9440 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ResourceIdentityType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The type of identity used for the private cloud. The type 'SystemAssigned' refers to an implicitly created identity. The type 'None' will remove any identities from the Private Cloud. + public readonly partial struct ResourceIdentityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceIdentityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SystemAssignedValue = "SystemAssigned"; + private const string NoneValue = "None"; + + /// SystemAssigned. + public static ResourceIdentityType SystemAssigned { get; } = new ResourceIdentityType(SystemAssignedValue); + /// None. + public static ResourceIdentityType None { get; } = new ResourceIdentityType(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceIdentityType left, ResourceIdentityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceIdentityType left, ResourceIdentityType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ResourceIdentityType(string value) => new ResourceIdentityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceIdentityType other && Equals(other); + /// + public bool Equals(ResourceIdentityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.Serialization.cs new file mode 100644 index 000000000000..c7b6a488a5ee --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.Serialization.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class ScriptCmdlet : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ScriptCmdlet DeserializeScriptCmdlet(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional description = default; + Optional timeout = default; + Optional> parameters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description")) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("timeout")) + { + timeout = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("parameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ScriptParameter.DeserializeScriptParameter(item)); + } + parameters = array; + continue; + } + } + continue; + } + } + return new ScriptCmdlet(id, name, type, description.Value, timeout.Value, Optional.ToList(parameters)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.cs new file mode 100644 index 000000000000..8ef53a48e236 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A cmdlet available for script execution. + public partial class ScriptCmdlet : Resource + { + /// Initializes a new instance of ScriptCmdlet. + public ScriptCmdlet() + { + Parameters = new ChangeTrackingList(); + } + + /// Initializes a new instance of ScriptCmdlet. + /// The id. + /// The name. + /// The type. + /// Description of the scripts functionality. + /// Recommended time limit for execution. + /// Parameters the script will accept. + internal ScriptCmdlet(ResourceIdentifier id, string name, ResourceType type, string description, string timeout, IReadOnlyList parameters) : base(id, name, type) + { + Description = description; + Timeout = timeout; + Parameters = parameters; + } + + /// Description of the scripts functionality. + public string Description { get; } + /// Recommended time limit for execution. + public string Timeout { get; } + /// Parameters the script will accept. + public IReadOnlyList Parameters { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs new file mode 100644 index 000000000000..fc6f49347562 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class ScriptCmdletsList + { + internal static ScriptCmdletsList DeserializeScriptCmdletsList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScriptCmdlet.DeserializeScriptCmdlet(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ScriptCmdletsList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs new file mode 100644 index 000000000000..8350df081fef --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Pageable list of scripts/cmdlets. + internal partial class ScriptCmdletsList + { + /// Initializes a new instance of ScriptCmdletsList. + internal ScriptCmdletsList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ScriptCmdletsList. + /// List of scripts. + /// URL to get the next page if any. + internal ScriptCmdletsList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of scripts. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs new file mode 100644 index 000000000000..aa33e74c3599 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class ScriptExecutionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(ScriptCmdletId)) + { + writer.WritePropertyName("scriptCmdletId"); + writer.WriteStringValue(ScriptCmdletId); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"); + writer.WriteStartArray(); + foreach (var item in Parameters) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(HiddenParameters)) + { + writer.WritePropertyName("hiddenParameters"); + writer.WriteStartArray(); + foreach (var item in HiddenParameters) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FailureReason)) + { + writer.WritePropertyName("failureReason"); + writer.WriteStringValue(FailureReason); + } + if (Optional.IsDefined(Timeout)) + { + writer.WritePropertyName("timeout"); + writer.WriteStringValue(Timeout); + } + if (Optional.IsDefined(Retention)) + { + writer.WritePropertyName("retention"); + writer.WriteStringValue(Retention); + } + if (Optional.IsCollectionDefined(Output)) + { + writer.WritePropertyName("output"); + writer.WriteStartArray(); + foreach (var item in Output) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NamedOutputs)) + { + writer.WritePropertyName("namedOutputs"); + writer.WriteStartObject(); + foreach (var item in NamedOutputs) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional scriptCmdletId = default; + Optional> parameters = default; + Optional> hiddenParameters = default; + Optional failureReason = default; + Optional timeout = default; + Optional retention = default; + Optional submittedAt = default; + Optional startedAt = default; + Optional finishedAt = default; + Optional provisioningState = default; + Optional> output = default; + Optional> namedOutputs = default; + Optional> information = default; + Optional> warnings = default; + Optional> errors = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("scriptCmdletId")) + { + scriptCmdletId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("parameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ScriptExecutionParameter.DeserializeScriptExecutionParameter(item)); + } + parameters = array; + continue; + } + if (property0.NameEquals("hiddenParameters")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ScriptExecutionParameter.DeserializeScriptExecutionParameter(item)); + } + hiddenParameters = array; + continue; + } + if (property0.NameEquals("failureReason")) + { + failureReason = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("timeout")) + { + timeout = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("retention")) + { + retention = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("submittedAt")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + submittedAt = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("startedAt")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + startedAt = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("finishedAt")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + finishedAt = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new ScriptExecutionProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("output")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + output = array; + continue; + } + if (property0.NameEquals("namedOutputs")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetObject()); + } + namedOutputs = dictionary; + continue; + } + if (property0.NameEquals("information")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + information = array; + continue; + } + if (property0.NameEquals("warnings")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + warnings = array; + continue; + } + if (property0.NameEquals("errors")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + errors = array; + continue; + } + } + continue; + } + } + return new ScriptExecutionData(id, name, type, scriptCmdletId.Value, Optional.ToList(parameters), Optional.ToList(hiddenParameters), failureReason.Value, timeout.Value, retention.Value, Optional.ToNullable(submittedAt), Optional.ToNullable(startedAt), Optional.ToNullable(finishedAt), Optional.ToNullable(provisioningState), Optional.ToList(output), Optional.ToDictionary(namedOutputs), Optional.ToList(information), Optional.ToList(warnings), Optional.ToList(errors)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.Serialization.cs new file mode 100644 index 000000000000..7ff1a415df4b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.Serialization.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class ScriptExecutionParameter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.ToString()); + writer.WriteEndObject(); + } + + internal static ScriptExecutionParameter DeserializeScriptExecutionParameter(JsonElement element) + { + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Credential": return PSCredentialExecutionParameter.DeserializePSCredentialExecutionParameter(element); + case "SecureValue": return ScriptSecureStringExecutionParameter.DeserializeScriptSecureStringExecutionParameter(element); + case "Value": return ScriptStringExecutionParameter.DeserializeScriptStringExecutionParameter(element); + } + } + string name = default; + ScriptExecutionParameterType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new ScriptExecutionParameterType(property.Value.GetString()); + continue; + } + } + return new ScriptExecutionParameter(name, type); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.cs new file mode 100644 index 000000000000..07623d4b0ad0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameter.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The arguments passed in to the execution. + public partial class ScriptExecutionParameter + { + /// Initializes a new instance of ScriptExecutionParameter. + /// The parameter name. + /// is null. + public ScriptExecutionParameter(string name) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Name = name; + } + + /// Initializes a new instance of ScriptExecutionParameter. + /// The parameter name. + /// The type of execution parameter. + internal ScriptExecutionParameter(string name, ScriptExecutionParameterType type) + { + Name = name; + Type = type; + } + + /// The parameter name. + public string Name { get; set; } + /// The type of execution parameter. + internal ScriptExecutionParameterType Type { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterType.cs new file mode 100644 index 000000000000..dcda8d72b96b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionParameterType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The type of execution parameter. + public readonly partial struct ScriptExecutionParameterType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScriptExecutionParameterType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ValueValue = "Value"; + private const string SecureValueValue = "SecureValue"; + private const string CredentialValue = "Credential"; + + /// Value. + public static ScriptExecutionParameterType Value { get; } = new ScriptExecutionParameterType(ValueValue); + /// SecureValue. + public static ScriptExecutionParameterType SecureValue { get; } = new ScriptExecutionParameterType(SecureValueValue); + /// Credential. + public static ScriptExecutionParameterType Credential { get; } = new ScriptExecutionParameterType(CredentialValue); + /// Determines if two values are the same. + public static bool operator ==(ScriptExecutionParameterType left, ScriptExecutionParameterType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScriptExecutionParameterType left, ScriptExecutionParameterType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ScriptExecutionParameterType(string value) => new ScriptExecutionParameterType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScriptExecutionParameterType other && Equals(other); + /// + public bool Equals(ScriptExecutionParameterType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionProvisioningState.cs new file mode 100644 index 000000000000..0bc8e648897f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The state of the script execution resource. + public readonly partial struct ScriptExecutionProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScriptExecutionProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "Pending"; + private const string RunningValue = "Running"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CancellingValue = "Cancelling"; + private const string CancelledValue = "Cancelled"; + private const string DeletingValue = "Deleting"; + + /// Pending. + public static ScriptExecutionProvisioningState Pending { get; } = new ScriptExecutionProvisioningState(PendingValue); + /// Running. + public static ScriptExecutionProvisioningState Running { get; } = new ScriptExecutionProvisioningState(RunningValue); + /// Succeeded. + public static ScriptExecutionProvisioningState Succeeded { get; } = new ScriptExecutionProvisioningState(SucceededValue); + /// Failed. + public static ScriptExecutionProvisioningState Failed { get; } = new ScriptExecutionProvisioningState(FailedValue); + /// Cancelling. + public static ScriptExecutionProvisioningState Cancelling { get; } = new ScriptExecutionProvisioningState(CancellingValue); + /// Cancelled. + public static ScriptExecutionProvisioningState Cancelled { get; } = new ScriptExecutionProvisioningState(CancelledValue); + /// Deleting. + public static ScriptExecutionProvisioningState Deleting { get; } = new ScriptExecutionProvisioningState(DeletingValue); + /// Determines if two values are the same. + public static bool operator ==(ScriptExecutionProvisioningState left, ScriptExecutionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScriptExecutionProvisioningState left, ScriptExecutionProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ScriptExecutionProvisioningState(string value) => new ScriptExecutionProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScriptExecutionProvisioningState other && Equals(other); + /// + public bool Equals(ScriptExecutionProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs new file mode 100644 index 000000000000..08c85b9bbca1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class ScriptExecutionsList + { + internal static ScriptExecutionsList DeserializeScriptExecutionsList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScriptExecutionData.DeserializeScriptExecutionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ScriptExecutionsList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs new file mode 100644 index 000000000000..4c81417d6982 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Pageable list of script executions. + internal partial class ScriptExecutionsList + { + /// Initializes a new instance of ScriptExecutionsList. + internal ScriptExecutionsList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ScriptExecutionsList. + /// List of scripts. + /// URL to get the next page if any. + internal ScriptExecutionsList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of scripts. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptOutputStreamType.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptOutputStreamType.cs new file mode 100644 index 000000000000..f5ca7eda8be6 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptOutputStreamType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The ScriptOutputStreamType. + public readonly partial struct ScriptOutputStreamType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScriptOutputStreamType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InformationValue = "Information"; + private const string WarningValue = "Warning"; + private const string OutputValue = "Output"; + private const string ErrorValue = "Error"; + + /// Information. + public static ScriptOutputStreamType Information { get; } = new ScriptOutputStreamType(InformationValue); + /// Warning. + public static ScriptOutputStreamType Warning { get; } = new ScriptOutputStreamType(WarningValue); + /// Output. + public static ScriptOutputStreamType Output { get; } = new ScriptOutputStreamType(OutputValue); + /// Error. + public static ScriptOutputStreamType Error { get; } = new ScriptOutputStreamType(ErrorValue); + /// Determines if two values are the same. + public static bool operator ==(ScriptOutputStreamType left, ScriptOutputStreamType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScriptOutputStreamType left, ScriptOutputStreamType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ScriptOutputStreamType(string value) => new ScriptOutputStreamType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScriptOutputStreamType other && Equals(other); + /// + public bool Equals(ScriptOutputStreamType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.Serialization.cs new file mode 100644 index 000000000000..acc1bac25536 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.Serialization.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class ScriptPackage : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ScriptPackage DeserializeScriptPackage(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional description = default; + Optional version = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("description")) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("version")) + { + version = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ScriptPackage(id, name, type, description.Value, version.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.cs new file mode 100644 index 000000000000..95af1787e821 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Script Package resources available for execution. + public partial class ScriptPackage : Resource + { + /// Initializes a new instance of ScriptPackage. + public ScriptPackage() + { + } + + /// Initializes a new instance of ScriptPackage. + /// The id. + /// The name. + /// The type. + /// User friendly description of the package. + /// Module version. + internal ScriptPackage(ResourceIdentifier id, string name, ResourceType type, string description, string version) : base(id, name, type) + { + Description = description; + Version = version; + } + + /// User friendly description of the package. + public string Description { get; } + /// Module version. + public string Version { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs new file mode 100644 index 000000000000..0132c4d226de --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class ScriptPackagesList + { + internal static ScriptPackagesList DeserializeScriptPackagesList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScriptPackage.DeserializeScriptPackage(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ScriptPackagesList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs new file mode 100644 index 000000000000..c5db2cf52598 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of the available script packages. + internal partial class ScriptPackagesList + { + /// Initializes a new instance of ScriptPackagesList. + internal ScriptPackagesList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ScriptPackagesList. + /// List of script package resources. + /// URL to get the next page if any. + internal ScriptPackagesList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of script package resources. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs new file mode 100644 index 000000000000..81f999dc9a1f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class ScriptParameter + { + internal static ScriptParameter DeserializeScriptParameter(JsonElement element) + { + Optional type = default; + Optional name = default; + Optional description = default; + Optional visibility = default; + Optional optional = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = new ScriptParameterTypes(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description")) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("visibility")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + visibility = new VisibilityParameterEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("optional")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + optional = new OptionalParamEnum(property.Value.GetString()); + continue; + } + } + return new ScriptParameter(Azure.Core.Optional.ToNullable(type), name.Value, description.Value, Azure.Core.Optional.ToNullable(visibility), Azure.Core.Optional.ToNullable(optional)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs new file mode 100644 index 000000000000..65c63f221b02 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameter.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// An parameter that the script will accept. + public partial class ScriptParameter + { + /// Initializes a new instance of ScriptParameter. + internal ScriptParameter() + { + } + + /// Initializes a new instance of ScriptParameter. + /// The type of parameter the script is expecting. psCredential is a PSCredentialObject. + /// The parameter name that the script will expect a parameter value for. + /// User friendly description of the parameter. + /// Should this parameter be visible to arm and passed in the parameters argument when executing. + /// Is this parameter required or optional. + internal ScriptParameter(ScriptParameterTypes? type, string name, string description, VisibilityParameterEnum? visibility, OptionalParamEnum? optional) + { + Type = type; + Name = name; + Description = description; + Visibility = visibility; + Optional = optional; + } + + /// The type of parameter the script is expecting. psCredential is a PSCredentialObject. + public ScriptParameterTypes? Type { get; } + /// The parameter name that the script will expect a parameter value for. + public string Name { get; } + /// User friendly description of the parameter. + public string Description { get; } + /// Should this parameter be visible to arm and passed in the parameters argument when executing. + public VisibilityParameterEnum? Visibility { get; } + /// Is this parameter required or optional. + public OptionalParamEnum? Optional { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameterTypes.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameterTypes.cs new file mode 100644 index 000000000000..93f68f2c5d1c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptParameterTypes.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The type of parameter the script is expecting. psCredential is a PSCredentialObject. + public readonly partial struct ScriptParameterTypes : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScriptParameterTypes(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StringValue = "String"; + private const string SecureStringValue = "SecureString"; + private const string CredentialValue = "Credential"; + private const string IntValue = "Int"; + private const string BoolValue = "Bool"; + private const string FloatValue = "Float"; + + /// String. + public static ScriptParameterTypes String { get; } = new ScriptParameterTypes(StringValue); + /// SecureString. + public static ScriptParameterTypes SecureString { get; } = new ScriptParameterTypes(SecureStringValue); + /// Credential. + public static ScriptParameterTypes Credential { get; } = new ScriptParameterTypes(CredentialValue); + /// Int. + public static ScriptParameterTypes Int { get; } = new ScriptParameterTypes(IntValue); + /// Bool. + public static ScriptParameterTypes Bool { get; } = new ScriptParameterTypes(BoolValue); + /// Float. + public static ScriptParameterTypes Float { get; } = new ScriptParameterTypes(FloatValue); + /// Determines if two values are the same. + public static bool operator ==(ScriptParameterTypes left, ScriptParameterTypes right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScriptParameterTypes left, ScriptParameterTypes right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ScriptParameterTypes(string value) => new ScriptParameterTypes(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScriptParameterTypes other && Equals(other); + /// + public bool Equals(ScriptParameterTypes other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.Serialization.cs new file mode 100644 index 000000000000..384446faa14c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class ScriptSecureStringExecutionParameter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SecureValue)) + { + writer.WritePropertyName("secureValue"); + writer.WriteStringValue(SecureValue); + } + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.ToString()); + writer.WriteEndObject(); + } + + internal static ScriptSecureStringExecutionParameter DeserializeScriptSecureStringExecutionParameter(JsonElement element) + { + Optional secureValue = default; + string name = default; + ScriptExecutionParameterType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secureValue")) + { + secureValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new ScriptExecutionParameterType(property.Value.GetString()); + continue; + } + } + return new ScriptSecureStringExecutionParameter(name, type, secureValue.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.cs new file mode 100644 index 000000000000..01db56dc2ffc --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptSecureStringExecutionParameter.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Avs.Models +{ + /// a plain text value execution parameter. + public partial class ScriptSecureStringExecutionParameter : ScriptExecutionParameter + { + /// Initializes a new instance of ScriptSecureStringExecutionParameter. + /// The parameter name. + /// is null. + public ScriptSecureStringExecutionParameter(string name) : base(name) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Type = ScriptExecutionParameterType.SecureValue; + } + + /// Initializes a new instance of ScriptSecureStringExecutionParameter. + /// The parameter name. + /// The type of execution parameter. + /// A secure value for the passed parameter, not to be stored in logs. + internal ScriptSecureStringExecutionParameter(string name, ScriptExecutionParameterType type, string secureValue) : base(name, type) + { + SecureValue = secureValue; + Type = type; + } + + /// A secure value for the passed parameter, not to be stored in logs. + public string SecureValue { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.Serialization.cs new file mode 100644 index 000000000000..adbf0a4ce454 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class ScriptStringExecutionParameter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"); + writer.WriteStringValue(Value); + } + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.ToString()); + writer.WriteEndObject(); + } + + internal static ScriptStringExecutionParameter DeserializeScriptStringExecutionParameter(JsonElement element) + { + Optional value = default; + string name = default; + ScriptExecutionParameterType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new ScriptExecutionParameterType(property.Value.GetString()); + continue; + } + } + return new ScriptStringExecutionParameter(name, type, value.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.cs new file mode 100644 index 000000000000..10e640b104a2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptStringExecutionParameter.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Avs.Models +{ + /// a plain text value execution parameter. + public partial class ScriptStringExecutionParameter : ScriptExecutionParameter + { + /// Initializes a new instance of ScriptStringExecutionParameter. + /// The parameter name. + /// is null. + public ScriptStringExecutionParameter(string name) : base(name) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Type = ScriptExecutionParameterType.Value; + } + + /// Initializes a new instance of ScriptStringExecutionParameter. + /// The parameter name. + /// The type of execution parameter. + /// The value for the passed parameter. + internal ScriptStringExecutionParameter(string name, ScriptExecutionParameterType type, string value) : base(name, type) + { + Value = value; + Type = type; + } + + /// The value for the passed parameter. + public string Value { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SegmentStatusEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SegmentStatusEnum.cs new file mode 100644 index 000000000000..6dbcefb6cb7e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SegmentStatusEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Segment status. + public readonly partial struct SegmentStatusEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SegmentStatusEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SuccessValue = "SUCCESS"; + private const string FailureValue = "FAILURE"; + + /// SUCCESS. + public static SegmentStatusEnum Success { get; } = new SegmentStatusEnum(SuccessValue); + /// FAILURE. + public static SegmentStatusEnum Failure { get; } = new SegmentStatusEnum(FailureValue); + /// Determines if two values are the same. + public static bool operator ==(SegmentStatusEnum left, SegmentStatusEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SegmentStatusEnum left, SegmentStatusEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SegmentStatusEnum(string value) => new SegmentStatusEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SegmentStatusEnum other && Equals(other); + /// + public bool Equals(SegmentStatusEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Sku.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Sku.Serialization.cs new file mode 100644 index 000000000000..d7ac4dc72405 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Sku.Serialization.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class Sku : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"); + writer.WriteStringValue(Name); + writer.WriteEndObject(); + } + + internal static Sku DeserializeSku(JsonElement element) + { + string name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + } + return new Sku(name); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Sku.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Sku.cs new file mode 100644 index 000000000000..c2ba114d1ec8 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Sku.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The resource model definition representing SKU. + public partial class Sku + { + /// Initializes a new instance of Sku. + /// The name of the SKU. + /// is null. + public Sku(string name) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + Name = name; + } + + /// The name of the SKU. + public string Name { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SslEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SslEnum.cs new file mode 100644 index 000000000000..70c44a642ff2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/SslEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Protect LDAP communication using SSL certificate (LDAPS). + public readonly partial struct SslEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SslEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static SslEnum Enabled { get; } = new SslEnum(EnabledValue); + /// Disabled. + public static SslEnum Disabled { get; } = new SslEnum(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(SslEnum left, SslEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SslEnum left, SslEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SslEnum(string value) => new SslEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SslEnum other && Equals(other); + /// + public bool Equals(SslEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.Serialization.cs new file mode 100644 index 000000000000..42bf96ddd663 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.Serialization.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class Trial + { + internal static Trial DeserializeTrial(JsonElement element) + { + Optional status = default; + Optional availableHosts = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new TrialStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("availableHosts")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + availableHosts = property.Value.GetInt32(); + continue; + } + } + return new Trial(Optional.ToNullable(status), Optional.ToNullable(availableHosts)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.cs new file mode 100644 index 000000000000..cbfc1635b5e1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/Trial.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// Subscription trial availability. + public partial class Trial + { + /// Initializes a new instance of Trial. + internal Trial() + { + } + + /// Initializes a new instance of Trial. + /// Trial status. + /// Number of trial hosts available. + internal Trial(TrialStatus? status, int? availableHosts) + { + Status = status; + AvailableHosts = availableHosts; + } + + /// Trial status. + public TrialStatus? Status { get; } + /// Number of trial hosts available. + public int? AvailableHosts { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/TrialStatus.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/TrialStatus.cs new file mode 100644 index 000000000000..55af1ed74d2f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/TrialStatus.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Trial status. + public readonly partial struct TrialStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TrialStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrialAvailableValue = "TrialAvailable"; + private const string TrialUsedValue = "TrialUsed"; + private const string TrialDisabledValue = "TrialDisabled"; + + /// TrialAvailable. + public static TrialStatus TrialAvailable { get; } = new TrialStatus(TrialAvailableValue); + /// TrialUsed. + public static TrialStatus TrialUsed { get; } = new TrialStatus(TrialUsedValue); + /// TrialDisabled. + public static TrialStatus TrialDisabled { get; } = new TrialStatus(TrialDisabledValue); + /// Determines if two values are the same. + public static bool operator ==(TrialStatus left, TrialStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TrialStatus left, TrialStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TrialStatus(string value) => new TrialStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TrialStatus other && Equals(other); + /// + public bool Equals(TrialStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VMGroupStatusEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VMGroupStatusEnum.cs new file mode 100644 index 000000000000..211b4c72bb42 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VMGroupStatusEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// VM Group status. + public readonly partial struct VMGroupStatusEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VMGroupStatusEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SuccessValue = "SUCCESS"; + private const string FailureValue = "FAILURE"; + + /// SUCCESS. + public static VMGroupStatusEnum Success { get; } = new VMGroupStatusEnum(SuccessValue); + /// FAILURE. + public static VMGroupStatusEnum Failure { get; } = new VMGroupStatusEnum(FailureValue); + /// Determines if two values are the same. + public static bool operator ==(VMGroupStatusEnum left, VMGroupStatusEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VMGroupStatusEnum left, VMGroupStatusEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VMGroupStatusEnum(string value) => new VMGroupStatusEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VMGroupStatusEnum other && Equals(other); + /// + public bool Equals(VMGroupStatusEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VMTypeEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VMTypeEnum.cs new file mode 100644 index 000000000000..9d0e193ca438 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VMTypeEnum.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Virtual machine type. + public readonly partial struct VMTypeEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VMTypeEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RegularValue = "REGULAR"; + private const string EdgeValue = "EDGE"; + private const string ServiceValue = "SERVICE"; + + /// REGULAR. + public static VMTypeEnum Regular { get; } = new VMTypeEnum(RegularValue); + /// EDGE. + public static VMTypeEnum Edge { get; } = new VMTypeEnum(EdgeValue); + /// SERVICE. + public static VMTypeEnum Service { get; } = new VMTypeEnum(ServiceValue); + /// Determines if two values are the same. + public static bool operator ==(VMTypeEnum left, VMTypeEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VMTypeEnum left, VMTypeEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VMTypeEnum(string value) => new VMTypeEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VMTypeEnum other && Equals(other); + /// + public bool Equals(VMTypeEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.Serialization.cs new file mode 100644 index 000000000000..e57c77d614e0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.Serialization.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class VirtualMachine : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static VirtualMachine DeserializeVirtualMachine(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional displayName = default; + Optional moRefId = default; + Optional folderPath = default; + Optional restrictMovement = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("moRefId")) + { + moRefId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("folderPath")) + { + folderPath = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("restrictMovement")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + restrictMovement = new VirtualMachineRestrictMovementState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new VirtualMachine(id, name, type, displayName.Value, moRefId.Value, folderPath.Value, Optional.ToNullable(restrictMovement)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.cs new file mode 100644 index 000000000000..719876088237 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Virtual Machine. + public partial class VirtualMachine : Resource + { + /// Initializes a new instance of VirtualMachine. + public VirtualMachine() + { + } + + /// Initializes a new instance of VirtualMachine. + /// The id. + /// The name. + /// The type. + /// Display name of the VM. + /// Virtual machine managed object reference id. + /// Path to virtual machine's folder starting from datacenter virtual machine folder. + /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). + internal VirtualMachine(ResourceIdentifier id, string name, ResourceType type, string displayName, string moRefId, string folderPath, VirtualMachineRestrictMovementState? restrictMovement) : base(id, name, type) + { + DisplayName = displayName; + MoRefId = moRefId; + FolderPath = folderPath; + RestrictMovement = restrictMovement; + } + + /// Display name of the VM. + public string DisplayName { get; } + /// Virtual machine managed object reference id. + public string MoRefId { get; } + /// Path to virtual machine's folder starting from datacenter virtual machine folder. + public string FolderPath { get; } + /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). + public VirtualMachineRestrictMovementState? RestrictMovement { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.Serialization.cs new file mode 100644 index 000000000000..4c070f323d63 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class VirtualMachineRestrictMovement : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(RestrictMovement)) + { + writer.WritePropertyName("restrictMovement"); + writer.WriteStringValue(RestrictMovement.Value.ToString()); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.cs new file mode 100644 index 000000000000..cef439e5d62a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovement.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// Set VM DRS-driven movement to restricted (enabled) or not (disabled). + public partial class VirtualMachineRestrictMovement + { + /// Initializes a new instance of VirtualMachineRestrictMovement. + public VirtualMachineRestrictMovement() + { + } + + /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). + public VirtualMachineRestrictMovementState? RestrictMovement { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovementState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovementState.cs new file mode 100644 index 000000000000..a3138676d386 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineRestrictMovementState.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). + public readonly partial struct VirtualMachineRestrictMovementState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VirtualMachineRestrictMovementState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static VirtualMachineRestrictMovementState Enabled { get; } = new VirtualMachineRestrictMovementState(EnabledValue); + /// Disabled. + public static VirtualMachineRestrictMovementState Disabled { get; } = new VirtualMachineRestrictMovementState(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(VirtualMachineRestrictMovementState left, VirtualMachineRestrictMovementState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VirtualMachineRestrictMovementState left, VirtualMachineRestrictMovementState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VirtualMachineRestrictMovementState(string value) => new VirtualMachineRestrictMovementState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VirtualMachineRestrictMovementState other && Equals(other); + /// + public bool Equals(VirtualMachineRestrictMovementState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs new file mode 100644 index 000000000000..1f2a622a96ab --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class VirtualMachinesList + { + internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VirtualMachine.DeserializeVirtualMachine(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new VirtualMachinesList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs new file mode 100644 index 000000000000..b6e2e2be4915 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of Virtual Machines. + internal partial class VirtualMachinesList + { + /// Initializes a new instance of VirtualMachinesList. + internal VirtualMachinesList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of VirtualMachinesList. + /// The items to be displayed on the page. + /// URL to get the next page if any. + internal VirtualMachinesList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items to be displayed on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VisibilityParameterEnum.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VisibilityParameterEnum.cs new file mode 100644 index 000000000000..c82df3888b51 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VisibilityParameterEnum.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Should this parameter be visible to arm and passed in the parameters argument when executing. + public readonly partial struct VisibilityParameterEnum : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VisibilityParameterEnum(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string VisibleValue = "Visible"; + private const string HiddenValue = "Hidden"; + + /// Visible. + public static VisibilityParameterEnum Visible { get; } = new VisibilityParameterEnum(VisibleValue); + /// Hidden. + public static VisibilityParameterEnum Hidden { get; } = new VisibilityParameterEnum(HiddenValue); + /// Determines if two values are the same. + public static bool operator ==(VisibilityParameterEnum left, VisibilityParameterEnum right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VisibilityParameterEnum left, VisibilityParameterEnum right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VisibilityParameterEnum(string value) => new VisibilityParameterEnum(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VisibilityParameterEnum other && Equals(other); + /// + public bool Equals(VisibilityParameterEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs new file mode 100644 index 000000000000..678fcf9a5795 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.Serialization.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class VmHostPlacementPolicyProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("vmMembers"); + writer.WriteStartArray(); + foreach (var item in VmMembers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("hostMembers"); + writer.WriteStartArray(); + foreach (var item in HostMembers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("affinityType"); + writer.WriteStringValue(AffinityType.ToString()); + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.ToString()); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + writer.WriteEndObject(); + } + + internal static VmHostPlacementPolicyProperties DeserializeVmHostPlacementPolicyProperties(JsonElement element) + { + IList vmMembers = default; + IList hostMembers = default; + AffinityType affinityType = default; + PlacementPolicyType type = default; + Optional state = default; + Optional displayName = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vmMembers")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + vmMembers = array; + continue; + } + if (property.NameEquals("hostMembers")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + hostMembers = array; + continue; + } + if (property.NameEquals("affinityType")) + { + affinityType = new AffinityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("type")) + { + type = new PlacementPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("state")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + state = new PlacementPolicyState(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName")) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new PlacementPolicyProvisioningState(property.Value.GetString()); + continue; + } + } + return new VmHostPlacementPolicyProperties(type, Optional.ToNullable(state), displayName.Value, Optional.ToNullable(provisioningState), vmMembers, hostMembers, affinityType); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs new file mode 100644 index 000000000000..498ce423ab51 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmHostPlacementPolicyProperties.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Avs.Models +{ + /// VM-Host placement policy properties. + public partial class VmHostPlacementPolicyProperties : PlacementPolicyProperties + { + /// Initializes a new instance of VmHostPlacementPolicyProperties. + /// Virtual machine members list. + /// Host members list. + /// placement policy affinity type. + /// or is null. + public VmHostPlacementPolicyProperties(IEnumerable vmMembers, IEnumerable hostMembers, AffinityType affinityType) + { + if (vmMembers == null) + { + throw new ArgumentNullException(nameof(vmMembers)); + } + if (hostMembers == null) + { + throw new ArgumentNullException(nameof(hostMembers)); + } + + VmMembers = vmMembers.ToList(); + HostMembers = hostMembers.ToList(); + AffinityType = affinityType; + Type = PlacementPolicyType.VmHost; + } + + /// Initializes a new instance of VmHostPlacementPolicyProperties. + /// placement policy type. + /// Whether the placement policy is enabled or disabled. + /// Display name of the placement policy. + /// The provisioning state. + /// Virtual machine members list. + /// Host members list. + /// placement policy affinity type. + internal VmHostPlacementPolicyProperties(PlacementPolicyType type, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IList vmMembers, IList hostMembers, AffinityType affinityType) : base(type, state, displayName, provisioningState) + { + VmMembers = vmMembers; + HostMembers = hostMembers; + AffinityType = affinityType; + Type = type; + } + + /// Virtual machine members list. + public IList VmMembers { get; } + /// Host members list. + public IList HostMembers { get; } + /// placement policy affinity type. + public AffinityType AffinityType { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs new file mode 100644 index 000000000000..cb332d985a1a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.Serialization.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class VmPlacementPolicyProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("vmMembers"); + writer.WriteStartArray(); + foreach (var item in VmMembers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("affinityType"); + writer.WriteStringValue(AffinityType.ToString()); + writer.WritePropertyName("type"); + writer.WriteStringValue(Type.ToString()); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + writer.WriteEndObject(); + } + + internal static VmPlacementPolicyProperties DeserializeVmPlacementPolicyProperties(JsonElement element) + { + IList vmMembers = default; + AffinityType affinityType = default; + PlacementPolicyType type = default; + Optional state = default; + Optional displayName = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vmMembers")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + vmMembers = array; + continue; + } + if (property.NameEquals("affinityType")) + { + affinityType = new AffinityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("type")) + { + type = new PlacementPolicyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("state")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + state = new PlacementPolicyState(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName")) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new PlacementPolicyProvisioningState(property.Value.GetString()); + continue; + } + } + return new VmPlacementPolicyProperties(type, Optional.ToNullable(state), displayName.Value, Optional.ToNullable(provisioningState), vmMembers, affinityType); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs new file mode 100644 index 000000000000..16369d10a885 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VmPlacementPolicyProperties.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Avs.Models +{ + /// VM-VM placement policy properties. + public partial class VmPlacementPolicyProperties : PlacementPolicyProperties + { + /// Initializes a new instance of VmPlacementPolicyProperties. + /// Virtual machine members list. + /// placement policy affinity type. + /// is null. + public VmPlacementPolicyProperties(IEnumerable vmMembers, AffinityType affinityType) + { + if (vmMembers == null) + { + throw new ArgumentNullException(nameof(vmMembers)); + } + + VmMembers = vmMembers.ToList(); + AffinityType = affinityType; + Type = PlacementPolicyType.VmVm; + } + + /// Initializes a new instance of VmPlacementPolicyProperties. + /// placement policy type. + /// Whether the placement policy is enabled or disabled. + /// Display name of the placement policy. + /// The provisioning state. + /// Virtual machine members list. + /// placement policy affinity type. + internal VmPlacementPolicyProperties(PlacementPolicyType type, PlacementPolicyState? state, string displayName, PlacementPolicyProvisioningState? provisioningState, IList vmMembers, AffinityType affinityType) : base(type, state, displayName, provisioningState) + { + VmMembers = vmMembers; + AffinityType = affinityType; + Type = type; + } + + /// Virtual machine members list. + public IList VmMembers { get; } + /// placement policy affinity type. + public AffinityType AffinityType { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.Serialization.cs new file mode 100644 index 000000000000..3ed9fdb73f05 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.Serialization.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkDhcp : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkDhcp DeserializeWorkloadNetworkDhcp(JsonElement element) + { + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = WorkloadNetworkDhcpEntity.DeserializeWorkloadNetworkDhcpEntity(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkDhcp(id, name, type, properties.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs new file mode 100644 index 000000000000..01e94630aecb --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX DHCP. + public partial class WorkloadNetworkDhcp : Resource + { + /// Initializes a new instance of WorkloadNetworkDhcp. + public WorkloadNetworkDhcp() + { + } + + /// Initializes a new instance of WorkloadNetworkDhcp. + /// The id. + /// The name. + /// The type. + /// DHCP properties. + internal WorkloadNetworkDhcp(ResourceIdentifier id, string name, ResourceType type, WorkloadNetworkDhcpEntity properties) : base(id, name, type) + { + Properties = properties; + } + + /// DHCP properties. + public WorkloadNetworkDhcpEntity Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.Serialization.cs new file mode 100644 index 000000000000..c92411b63e8a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.Serialization.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkDhcpEntity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("dhcpType"); + writer.WriteStringValue(DhcpType.ToString()); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"); + writer.WriteNumberValue(Revision.Value); + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkDhcpEntity DeserializeWorkloadNetworkDhcpEntity(JsonElement element) + { + if (element.TryGetProperty("dhcpType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "RELAY": return WorkloadNetworkDhcpRelay.DeserializeWorkloadNetworkDhcpRelay(element); + case "SERVER": return WorkloadNetworkDhcpServer.DeserializeWorkloadNetworkDhcpServer(element); + } + } + DhcpTypeEnum dhcpType = default; + Optional displayName = default; + Optional> segments = default; + Optional provisioningState = default; + Optional revision = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dhcpType")) + { + dhcpType = new DhcpTypeEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName")) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("segments")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + segments = array; + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new WorkloadNetworkDhcpProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("revision")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + revision = property.Value.GetInt64(); + continue; + } + } + return new WorkloadNetworkDhcpEntity(dhcpType, displayName.Value, Optional.ToList(segments), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs new file mode 100644 index 000000000000..2965adba8fab --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpEntity.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay to inherit from. + public partial class WorkloadNetworkDhcpEntity + { + /// Initializes a new instance of WorkloadNetworkDhcpEntity. + public WorkloadNetworkDhcpEntity() + { + Segments = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkDhcpEntity. + /// Type of DHCP: SERVER or RELAY. + /// Display name of the DHCP entity. + /// NSX Segments consuming DHCP. + /// The provisioning state. + /// NSX revision number. + internal WorkloadNetworkDhcpEntity(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision) + { + DhcpType = dhcpType; + DisplayName = displayName; + Segments = segments; + ProvisioningState = provisioningState; + Revision = revision; + } + + /// Type of DHCP: SERVER or RELAY. + internal DhcpTypeEnum DhcpType { get; set; } + /// Display name of the DHCP entity. + public string DisplayName { get; set; } + /// NSX Segments consuming DHCP. + public IReadOnlyList Segments { get; } + /// The provisioning state. + public WorkloadNetworkDhcpProvisioningState? ProvisioningState { get; } + /// NSX revision number. + public long? Revision { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs new file mode 100644 index 000000000000..bcd1ff8197e4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class WorkloadNetworkDhcpList + { + internal static WorkloadNetworkDhcpList DeserializeWorkloadNetworkDhcpList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkDhcpList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs new file mode 100644 index 000000000000..41fb64107c4b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of NSX dhcp entities. + internal partial class WorkloadNetworkDhcpList + { + /// Initializes a new instance of WorkloadNetworkDhcpList. + internal WorkloadNetworkDhcpList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkDhcpList. + /// The items on the page. + /// URL to get the next page if any. + internal WorkloadNetworkDhcpList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpProvisioningState.cs new file mode 100644 index 000000000000..f4fe95ebbc8d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The provisioning state. + public readonly partial struct WorkloadNetworkDhcpProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WorkloadNetworkDhcpProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static WorkloadNetworkDhcpProvisioningState Succeeded { get; } = new WorkloadNetworkDhcpProvisioningState(SucceededValue); + /// Failed. + public static WorkloadNetworkDhcpProvisioningState Failed { get; } = new WorkloadNetworkDhcpProvisioningState(FailedValue); + /// Building. + public static WorkloadNetworkDhcpProvisioningState Building { get; } = new WorkloadNetworkDhcpProvisioningState(BuildingValue); + /// Deleting. + public static WorkloadNetworkDhcpProvisioningState Deleting { get; } = new WorkloadNetworkDhcpProvisioningState(DeletingValue); + /// Updating. + public static WorkloadNetworkDhcpProvisioningState Updating { get; } = new WorkloadNetworkDhcpProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(WorkloadNetworkDhcpProvisioningState left, WorkloadNetworkDhcpProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WorkloadNetworkDhcpProvisioningState left, WorkloadNetworkDhcpProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator WorkloadNetworkDhcpProvisioningState(string value) => new WorkloadNetworkDhcpProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WorkloadNetworkDhcpProvisioningState other && Equals(other); + /// + public bool Equals(WorkloadNetworkDhcpProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.Serialization.cs new file mode 100644 index 000000000000..a9c0c2543742 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.Serialization.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkDhcpRelay : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(ServerAddresses)) + { + writer.WritePropertyName("serverAddresses"); + writer.WriteStartArray(); + foreach (var item in ServerAddresses) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("dhcpType"); + writer.WriteStringValue(DhcpType.ToString()); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"); + writer.WriteNumberValue(Revision.Value); + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkDhcpRelay DeserializeWorkloadNetworkDhcpRelay(JsonElement element) + { + Optional> serverAddresses = default; + DhcpTypeEnum dhcpType = default; + Optional displayName = default; + Optional> segments = default; + Optional provisioningState = default; + Optional revision = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("serverAddresses")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + serverAddresses = array; + continue; + } + if (property.NameEquals("dhcpType")) + { + dhcpType = new DhcpTypeEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName")) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("segments")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + segments = array; + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new WorkloadNetworkDhcpProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("revision")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + revision = property.Value.GetInt64(); + continue; + } + } + return new WorkloadNetworkDhcpRelay(dhcpType, displayName.Value, Optional.ToList(segments), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), Optional.ToList(serverAddresses)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs new file mode 100644 index 000000000000..3a69270f4e6a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpRelay.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX DHCP Relay. + public partial class WorkloadNetworkDhcpRelay : WorkloadNetworkDhcpEntity + { + /// Initializes a new instance of WorkloadNetworkDhcpRelay. + public WorkloadNetworkDhcpRelay() + { + ServerAddresses = new ChangeTrackingList(); + DhcpType = DhcpTypeEnum.Relay; + } + + /// Initializes a new instance of WorkloadNetworkDhcpRelay. + /// Type of DHCP: SERVER or RELAY. + /// Display name of the DHCP entity. + /// NSX Segments consuming DHCP. + /// The provisioning state. + /// NSX revision number. + /// DHCP Relay Addresses. Max 3. + internal WorkloadNetworkDhcpRelay(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision, IList serverAddresses) : base(dhcpType, displayName, segments, provisioningState, revision) + { + ServerAddresses = serverAddresses; + DhcpType = dhcpType; + } + + /// DHCP Relay Addresses. Max 3. + public IList ServerAddresses { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.Serialization.cs new file mode 100644 index 000000000000..83fc4052e715 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.Serialization.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkDhcpServer : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ServerAddress)) + { + writer.WritePropertyName("serverAddress"); + writer.WriteStringValue(ServerAddress); + } + if (Optional.IsDefined(LeaseTime)) + { + writer.WritePropertyName("leaseTime"); + writer.WriteNumberValue(LeaseTime.Value); + } + writer.WritePropertyName("dhcpType"); + writer.WriteStringValue(DhcpType.ToString()); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"); + writer.WriteNumberValue(Revision.Value); + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkDhcpServer DeserializeWorkloadNetworkDhcpServer(JsonElement element) + { + Optional serverAddress = default; + Optional leaseTime = default; + DhcpTypeEnum dhcpType = default; + Optional displayName = default; + Optional> segments = default; + Optional provisioningState = default; + Optional revision = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("serverAddress")) + { + serverAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("leaseTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + leaseTime = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("dhcpType")) + { + dhcpType = new DhcpTypeEnum(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayName")) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("segments")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + segments = array; + continue; + } + if (property.NameEquals("provisioningState")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new WorkloadNetworkDhcpProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("revision")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + revision = property.Value.GetInt64(); + continue; + } + } + return new WorkloadNetworkDhcpServer(dhcpType, displayName.Value, Optional.ToList(segments), Optional.ToNullable(provisioningState), Optional.ToNullable(revision), serverAddress.Value, Optional.ToNullable(leaseTime)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs new file mode 100644 index 000000000000..c095d657a4c7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpServer.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX DHCP Server. + public partial class WorkloadNetworkDhcpServer : WorkloadNetworkDhcpEntity + { + /// Initializes a new instance of WorkloadNetworkDhcpServer. + public WorkloadNetworkDhcpServer() + { + DhcpType = DhcpTypeEnum.Server; + } + + /// Initializes a new instance of WorkloadNetworkDhcpServer. + /// Type of DHCP: SERVER or RELAY. + /// Display name of the DHCP entity. + /// NSX Segments consuming DHCP. + /// The provisioning state. + /// NSX revision number. + /// DHCP Server Address. + /// DHCP Server Lease Time. + internal WorkloadNetworkDhcpServer(DhcpTypeEnum dhcpType, string displayName, IReadOnlyList segments, WorkloadNetworkDhcpProvisioningState? provisioningState, long? revision, string serverAddress, long? leaseTime) : base(dhcpType, displayName, segments, provisioningState, revision) + { + ServerAddress = serverAddress; + LeaseTime = leaseTime; + DhcpType = dhcpType; + } + + /// DHCP Server Address. + public string ServerAddress { get; set; } + /// DHCP Server Lease Time. + public long? LeaseTime { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.Serialization.cs new file mode 100644 index 000000000000..d9665d429d5b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkDnsService : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(DnsServiceIp)) + { + writer.WritePropertyName("dnsServiceIp"); + writer.WriteStringValue(DnsServiceIp); + } + if (Optional.IsDefined(DefaultDnsZone)) + { + writer.WritePropertyName("defaultDnsZone"); + writer.WriteStringValue(DefaultDnsZone); + } + if (Optional.IsCollectionDefined(FqdnZones)) + { + writer.WritePropertyName("fqdnZones"); + writer.WriteStartArray(); + foreach (var item in FqdnZones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(LogLevel)) + { + writer.WritePropertyName("logLevel"); + writer.WriteStringValue(LogLevel.Value.ToString()); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"); + writer.WriteNumberValue(Revision.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WorkloadNetworkDnsService DeserializeWorkloadNetworkDnsService(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional displayName = default; + Optional dnsServiceIp = default; + Optional defaultDnsZone = default; + Optional> fqdnZones = default; + Optional logLevel = default; + Optional status = default; + Optional provisioningState = default; + Optional revision = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("dnsServiceIp")) + { + dnsServiceIp = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("defaultDnsZone")) + { + defaultDnsZone = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("fqdnZones")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + fqdnZones = array; + continue; + } + if (property0.NameEquals("logLevel")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + logLevel = new DnsServiceLogLevelEnum(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("status")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new DnsServiceStatusEnum(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new WorkloadNetworkDnsServiceProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("revision")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + revision = property0.Value.GetInt64(); + continue; + } + } + continue; + } + } + return new WorkloadNetworkDnsService(id, name, type, displayName.Value, dnsServiceIp.Value, defaultDnsZone.Value, Optional.ToList(fqdnZones), Optional.ToNullable(logLevel), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.cs new file mode 100644 index 000000000000..93d65b096bd9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX DNS Service. + public partial class WorkloadNetworkDnsService : Resource + { + /// Initializes a new instance of WorkloadNetworkDnsService. + public WorkloadNetworkDnsService() + { + FqdnZones = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkDnsService. + /// The id. + /// The name. + /// The type. + /// Display name of the DNS Service. + /// DNS service IP of the DNS Service. + /// Default DNS zone of the DNS Service. + /// FQDN zones of the DNS Service. + /// DNS Service log level. + /// DNS Service status. + /// The provisioning state. + /// NSX revision number. + internal WorkloadNetworkDnsService(ResourceIdentifier id, string name, ResourceType type, string displayName, string dnsServiceIp, string defaultDnsZone, IList fqdnZones, DnsServiceLogLevelEnum? logLevel, DnsServiceStatusEnum? status, WorkloadNetworkDnsServiceProvisioningState? provisioningState, long? revision) : base(id, name, type) + { + DisplayName = displayName; + DnsServiceIp = dnsServiceIp; + DefaultDnsZone = defaultDnsZone; + FqdnZones = fqdnZones; + LogLevel = logLevel; + Status = status; + ProvisioningState = provisioningState; + Revision = revision; + } + + /// Display name of the DNS Service. + public string DisplayName { get; set; } + /// DNS service IP of the DNS Service. + public string DnsServiceIp { get; set; } + /// Default DNS zone of the DNS Service. + public string DefaultDnsZone { get; set; } + /// FQDN zones of the DNS Service. + public IList FqdnZones { get; } + /// DNS Service log level. + public DnsServiceLogLevelEnum? LogLevel { get; set; } + /// DNS Service status. + public DnsServiceStatusEnum? Status { get; } + /// The provisioning state. + public WorkloadNetworkDnsServiceProvisioningState? ProvisioningState { get; } + /// NSX revision number. + public long? Revision { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceProvisioningState.cs new file mode 100644 index 000000000000..fe972967f02b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The provisioning state. + public readonly partial struct WorkloadNetworkDnsServiceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WorkloadNetworkDnsServiceProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static WorkloadNetworkDnsServiceProvisioningState Succeeded { get; } = new WorkloadNetworkDnsServiceProvisioningState(SucceededValue); + /// Failed. + public static WorkloadNetworkDnsServiceProvisioningState Failed { get; } = new WorkloadNetworkDnsServiceProvisioningState(FailedValue); + /// Building. + public static WorkloadNetworkDnsServiceProvisioningState Building { get; } = new WorkloadNetworkDnsServiceProvisioningState(BuildingValue); + /// Deleting. + public static WorkloadNetworkDnsServiceProvisioningState Deleting { get; } = new WorkloadNetworkDnsServiceProvisioningState(DeletingValue); + /// Updating. + public static WorkloadNetworkDnsServiceProvisioningState Updating { get; } = new WorkloadNetworkDnsServiceProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(WorkloadNetworkDnsServiceProvisioningState left, WorkloadNetworkDnsServiceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WorkloadNetworkDnsServiceProvisioningState left, WorkloadNetworkDnsServiceProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator WorkloadNetworkDnsServiceProvisioningState(string value) => new WorkloadNetworkDnsServiceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WorkloadNetworkDnsServiceProvisioningState other && Equals(other); + /// + public bool Equals(WorkloadNetworkDnsServiceProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs new file mode 100644 index 000000000000..8b0c4db8e5a5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class WorkloadNetworkDnsServicesList + { + internal static WorkloadNetworkDnsServicesList DeserializeWorkloadNetworkDnsServicesList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkDnsServicesList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs new file mode 100644 index 000000000000..1b0108d201f3 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of NSX DNS Services. + internal partial class WorkloadNetworkDnsServicesList + { + /// Initializes a new instance of WorkloadNetworkDnsServicesList. + internal WorkloadNetworkDnsServicesList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkDnsServicesList. + /// The items on the page. + /// URL to get the next page if any. + internal WorkloadNetworkDnsServicesList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.Serialization.cs new file mode 100644 index 000000000000..9c5fab3f05cc --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.Serialization.cs @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkDnsZone : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsCollectionDefined(Domain)) + { + writer.WritePropertyName("domain"); + writer.WriteStartArray(); + foreach (var item in Domain) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(DnsServerIps)) + { + writer.WritePropertyName("dnsServerIps"); + writer.WriteStartArray(); + foreach (var item in DnsServerIps) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SourceIp)) + { + writer.WritePropertyName("sourceIp"); + writer.WriteStringValue(SourceIp); + } + if (Optional.IsDefined(DnsServices)) + { + writer.WritePropertyName("dnsServices"); + writer.WriteNumberValue(DnsServices.Value); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"); + writer.WriteNumberValue(Revision.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WorkloadNetworkDnsZone DeserializeWorkloadNetworkDnsZone(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional displayName = default; + Optional> domain = default; + Optional> dnsServerIps = default; + Optional sourceIp = default; + Optional dnsServices = default; + Optional provisioningState = default; + Optional revision = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("domain")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + domain = array; + continue; + } + if (property0.NameEquals("dnsServerIps")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dnsServerIps = array; + continue; + } + if (property0.NameEquals("sourceIp")) + { + sourceIp = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("dnsServices")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + dnsServices = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new WorkloadNetworkDnsZoneProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("revision")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + revision = property0.Value.GetInt64(); + continue; + } + } + continue; + } + } + return new WorkloadNetworkDnsZone(id, name, type, displayName.Value, Optional.ToList(domain), Optional.ToList(dnsServerIps), sourceIp.Value, Optional.ToNullable(dnsServices), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.cs new file mode 100644 index 000000000000..a7757a9ea2ee --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX DNS Zone. + public partial class WorkloadNetworkDnsZone : Resource + { + /// Initializes a new instance of WorkloadNetworkDnsZone. + public WorkloadNetworkDnsZone() + { + Domain = new ChangeTrackingList(); + DnsServerIps = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkDnsZone. + /// The id. + /// The name. + /// The type. + /// Display name of the DNS Zone. + /// Domain names of the DNS Zone. + /// DNS Server IP array of the DNS Zone. + /// Source IP of the DNS Zone. + /// Number of DNS Services using the DNS zone. + /// The provisioning state. + /// NSX revision number. + internal WorkloadNetworkDnsZone(ResourceIdentifier id, string name, ResourceType type, string displayName, IList domain, IList dnsServerIps, string sourceIp, long? dnsServices, WorkloadNetworkDnsZoneProvisioningState? provisioningState, long? revision) : base(id, name, type) + { + DisplayName = displayName; + Domain = domain; + DnsServerIps = dnsServerIps; + SourceIp = sourceIp; + DnsServices = dnsServices; + ProvisioningState = provisioningState; + Revision = revision; + } + + /// Display name of the DNS Zone. + public string DisplayName { get; set; } + /// Domain names of the DNS Zone. + public IList Domain { get; } + /// DNS Server IP array of the DNS Zone. + public IList DnsServerIps { get; } + /// Source IP of the DNS Zone. + public string SourceIp { get; set; } + /// Number of DNS Services using the DNS zone. + public long? DnsServices { get; set; } + /// The provisioning state. + public WorkloadNetworkDnsZoneProvisioningState? ProvisioningState { get; } + /// NSX revision number. + public long? Revision { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneProvisioningState.cs new file mode 100644 index 000000000000..83cb124f314d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The provisioning state. + public readonly partial struct WorkloadNetworkDnsZoneProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WorkloadNetworkDnsZoneProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static WorkloadNetworkDnsZoneProvisioningState Succeeded { get; } = new WorkloadNetworkDnsZoneProvisioningState(SucceededValue); + /// Failed. + public static WorkloadNetworkDnsZoneProvisioningState Failed { get; } = new WorkloadNetworkDnsZoneProvisioningState(FailedValue); + /// Building. + public static WorkloadNetworkDnsZoneProvisioningState Building { get; } = new WorkloadNetworkDnsZoneProvisioningState(BuildingValue); + /// Deleting. + public static WorkloadNetworkDnsZoneProvisioningState Deleting { get; } = new WorkloadNetworkDnsZoneProvisioningState(DeletingValue); + /// Updating. + public static WorkloadNetworkDnsZoneProvisioningState Updating { get; } = new WorkloadNetworkDnsZoneProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(WorkloadNetworkDnsZoneProvisioningState left, WorkloadNetworkDnsZoneProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WorkloadNetworkDnsZoneProvisioningState left, WorkloadNetworkDnsZoneProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator WorkloadNetworkDnsZoneProvisioningState(string value) => new WorkloadNetworkDnsZoneProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WorkloadNetworkDnsZoneProvisioningState other && Equals(other); + /// + public bool Equals(WorkloadNetworkDnsZoneProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs new file mode 100644 index 000000000000..a10eddb1aa9e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class WorkloadNetworkDnsZonesList + { + internal static WorkloadNetworkDnsZonesList DeserializeWorkloadNetworkDnsZonesList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkDnsZonesList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs new file mode 100644 index 000000000000..c3c450e2e492 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of NSX DNS Zones. + internal partial class WorkloadNetworkDnsZonesList + { + /// Initializes a new instance of WorkloadNetworkDnsZonesList. + internal WorkloadNetworkDnsZonesList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkDnsZonesList. + /// The items on the page. + /// URL to get the next page if any. + internal WorkloadNetworkDnsZonesList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.Serialization.cs new file mode 100644 index 000000000000..edeff8e38c32 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.Serialization.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkGateway : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WorkloadNetworkGateway DeserializeWorkloadNetworkGateway(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional displayName = default; + Optional path = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("path")) + { + path = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new WorkloadNetworkGateway(id, name, type, displayName.Value, path.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.cs new file mode 100644 index 000000000000..fd219defe426 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX Gateway. + public partial class WorkloadNetworkGateway : Resource + { + /// Initializes a new instance of WorkloadNetworkGateway. + public WorkloadNetworkGateway() + { + } + + /// Initializes a new instance of WorkloadNetworkGateway. + /// The id. + /// The name. + /// The type. + /// Display name of the DHCP entity. + /// NSX Gateway Path. + internal WorkloadNetworkGateway(ResourceIdentifier id, string name, ResourceType type, string displayName, string path) : base(id, name, type) + { + DisplayName = displayName; + Path = path; + } + + /// Display name of the DHCP entity. + public string DisplayName { get; set; } + /// NSX Gateway Path. + public string Path { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs new file mode 100644 index 000000000000..e9af3786ef3b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class WorkloadNetworkGatewayList + { + internal static WorkloadNetworkGatewayList DeserializeWorkloadNetworkGatewayList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkGateway.DeserializeWorkloadNetworkGateway(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkGatewayList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs new file mode 100644 index 000000000000..5463b58d614e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of NSX Gateways. + internal partial class WorkloadNetworkGatewayList + { + /// Initializes a new instance of WorkloadNetworkGatewayList. + internal WorkloadNetworkGatewayList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkGatewayList. + /// The items on the page. + /// URL to get the next page if any. + internal WorkloadNetworkGatewayList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.Serialization.cs new file mode 100644 index 000000000000..3be5a500d5db --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkPortMirroring : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Direction)) + { + writer.WritePropertyName("direction"); + writer.WriteStringValue(Direction.Value.ToString()); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"); + writer.WriteStringValue(Source); + } + if (Optional.IsDefined(Destination)) + { + writer.WritePropertyName("destination"); + writer.WriteStringValue(Destination); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"); + writer.WriteNumberValue(Revision.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WorkloadNetworkPortMirroring DeserializeWorkloadNetworkPortMirroring(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional displayName = default; + Optional direction = default; + Optional source = default; + Optional destination = default; + Optional status = default; + Optional provisioningState = default; + Optional revision = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("direction")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + direction = new PortMirroringDirectionEnum(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("source")) + { + source = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("destination")) + { + destination = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("status")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new PortMirroringStatusEnum(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new WorkloadNetworkPortMirroringProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("revision")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + revision = property0.Value.GetInt64(); + continue; + } + } + continue; + } + } + return new WorkloadNetworkPortMirroring(id, name, type, displayName.Value, Optional.ToNullable(direction), source.Value, destination.Value, Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs new file mode 100644 index 000000000000..d9cba25fc7e2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX Port Mirroring. + public partial class WorkloadNetworkPortMirroring : Resource + { + /// Initializes a new instance of WorkloadNetworkPortMirroring. + public WorkloadNetworkPortMirroring() + { + } + + /// Initializes a new instance of WorkloadNetworkPortMirroring. + /// The id. + /// The name. + /// The type. + /// Display name of the port mirroring profile. + /// Direction of port mirroring profile. + /// Source VM Group. + /// Destination VM Group. + /// Port Mirroring Status. + /// The provisioning state. + /// NSX revision number. + internal WorkloadNetworkPortMirroring(ResourceIdentifier id, string name, ResourceType type, string displayName, PortMirroringDirectionEnum? direction, string source, string destination, PortMirroringStatusEnum? status, WorkloadNetworkPortMirroringProvisioningState? provisioningState, long? revision) : base(id, name, type) + { + DisplayName = displayName; + Direction = direction; + Source = source; + Destination = destination; + Status = status; + ProvisioningState = provisioningState; + Revision = revision; + } + + /// Display name of the port mirroring profile. + public string DisplayName { get; set; } + /// Direction of port mirroring profile. + public PortMirroringDirectionEnum? Direction { get; set; } + /// Source VM Group. + public string Source { get; set; } + /// Destination VM Group. + public string Destination { get; set; } + /// Port Mirroring Status. + public PortMirroringStatusEnum? Status { get; } + /// The provisioning state. + public WorkloadNetworkPortMirroringProvisioningState? ProvisioningState { get; } + /// NSX revision number. + public long? Revision { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs new file mode 100644 index 000000000000..97c1a406eb00 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class WorkloadNetworkPortMirroringList + { + internal static WorkloadNetworkPortMirroringList DeserializeWorkloadNetworkPortMirroringList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkPortMirroringList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs new file mode 100644 index 000000000000..2838342d3d55 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of NSX Port Mirroring. + internal partial class WorkloadNetworkPortMirroringList + { + /// Initializes a new instance of WorkloadNetworkPortMirroringList. + internal WorkloadNetworkPortMirroringList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkPortMirroringList. + /// The items on the page. + /// URL to get the next page if any. + internal WorkloadNetworkPortMirroringList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs new file mode 100644 index 000000000000..549c9951a0bf --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The provisioning state. + public readonly partial struct WorkloadNetworkPortMirroringProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WorkloadNetworkPortMirroringProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static WorkloadNetworkPortMirroringProvisioningState Succeeded { get; } = new WorkloadNetworkPortMirroringProvisioningState(SucceededValue); + /// Failed. + public static WorkloadNetworkPortMirroringProvisioningState Failed { get; } = new WorkloadNetworkPortMirroringProvisioningState(FailedValue); + /// Building. + public static WorkloadNetworkPortMirroringProvisioningState Building { get; } = new WorkloadNetworkPortMirroringProvisioningState(BuildingValue); + /// Deleting. + public static WorkloadNetworkPortMirroringProvisioningState Deleting { get; } = new WorkloadNetworkPortMirroringProvisioningState(DeletingValue); + /// Updating. + public static WorkloadNetworkPortMirroringProvisioningState Updating { get; } = new WorkloadNetworkPortMirroringProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(WorkloadNetworkPortMirroringProvisioningState left, WorkloadNetworkPortMirroringProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WorkloadNetworkPortMirroringProvisioningState left, WorkloadNetworkPortMirroringProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator WorkloadNetworkPortMirroringProvisioningState(string value) => new WorkloadNetworkPortMirroringProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WorkloadNetworkPortMirroringProvisioningState other && Equals(other); + /// + public bool Equals(WorkloadNetworkPortMirroringProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.Serialization.cs new file mode 100644 index 000000000000..c10c4ab8a1ba --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.Serialization.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkPublicIP : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(NumberOfPublicIPs)) + { + writer.WritePropertyName("numberOfPublicIPs"); + writer.WriteNumberValue(NumberOfPublicIPs.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WorkloadNetworkPublicIP DeserializeWorkloadNetworkPublicIP(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional displayName = default; + Optional numberOfPublicIPs = default; + Optional publicIPBlock = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("numberOfPublicIPs")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + numberOfPublicIPs = property0.Value.GetInt64(); + continue; + } + if (property0.NameEquals("publicIPBlock")) + { + publicIPBlock = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new WorkloadNetworkPublicIPProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new WorkloadNetworkPublicIP(id, name, type, displayName.Value, Optional.ToNullable(numberOfPublicIPs), publicIPBlock.Value, Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.cs new file mode 100644 index 000000000000..253df4c4d18f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX Public IP Block. + public partial class WorkloadNetworkPublicIP : Resource + { + /// Initializes a new instance of WorkloadNetworkPublicIP. + public WorkloadNetworkPublicIP() + { + } + + /// Initializes a new instance of WorkloadNetworkPublicIP. + /// The id. + /// The name. + /// The type. + /// Display name of the Public IP Block. + /// Number of Public IPs requested. + /// CIDR Block of the Public IP Block. + /// The provisioning state. + internal WorkloadNetworkPublicIP(ResourceIdentifier id, string name, ResourceType type, string displayName, long? numberOfPublicIPs, string publicIPBlock, WorkloadNetworkPublicIPProvisioningState? provisioningState) : base(id, name, type) + { + DisplayName = displayName; + NumberOfPublicIPs = numberOfPublicIPs; + PublicIPBlock = publicIPBlock; + ProvisioningState = provisioningState; + } + + /// Display name of the Public IP Block. + public string DisplayName { get; set; } + /// Number of Public IPs requested. + public long? NumberOfPublicIPs { get; set; } + /// CIDR Block of the Public IP Block. + public string PublicIPBlock { get; } + /// The provisioning state. + public WorkloadNetworkPublicIPProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPProvisioningState.cs new file mode 100644 index 000000000000..2870f82adca2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The provisioning state. + public readonly partial struct WorkloadNetworkPublicIPProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WorkloadNetworkPublicIPProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static WorkloadNetworkPublicIPProvisioningState Succeeded { get; } = new WorkloadNetworkPublicIPProvisioningState(SucceededValue); + /// Failed. + public static WorkloadNetworkPublicIPProvisioningState Failed { get; } = new WorkloadNetworkPublicIPProvisioningState(FailedValue); + /// Building. + public static WorkloadNetworkPublicIPProvisioningState Building { get; } = new WorkloadNetworkPublicIPProvisioningState(BuildingValue); + /// Deleting. + public static WorkloadNetworkPublicIPProvisioningState Deleting { get; } = new WorkloadNetworkPublicIPProvisioningState(DeletingValue); + /// Updating. + public static WorkloadNetworkPublicIPProvisioningState Updating { get; } = new WorkloadNetworkPublicIPProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(WorkloadNetworkPublicIPProvisioningState left, WorkloadNetworkPublicIPProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WorkloadNetworkPublicIPProvisioningState left, WorkloadNetworkPublicIPProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator WorkloadNetworkPublicIPProvisioningState(string value) => new WorkloadNetworkPublicIPProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WorkloadNetworkPublicIPProvisioningState other && Equals(other); + /// + public bool Equals(WorkloadNetworkPublicIPProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs new file mode 100644 index 000000000000..0608a98a1c81 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class WorkloadNetworkPublicIPsList + { + internal static WorkloadNetworkPublicIPsList DeserializeWorkloadNetworkPublicIPsList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkPublicIPsList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs new file mode 100644 index 000000000000..cdf9298995ab --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of NSX Public IP Blocks. + internal partial class WorkloadNetworkPublicIPsList + { + /// Initializes a new instance of WorkloadNetworkPublicIPsList. + internal WorkloadNetworkPublicIPsList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkPublicIPsList. + /// The items on the page. + /// URL to get the next page if any. + internal WorkloadNetworkPublicIPsList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs new file mode 100644 index 000000000000..ed9ec8a617f4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; + +namespace Azure.ResourceManager.Avs +{ + public partial class WorkloadNetworkSegmentData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(ConnectedGateway)) + { + writer.WritePropertyName("connectedGateway"); + writer.WriteStringValue(ConnectedGateway); + } + if (Optional.IsDefined(Subnet)) + { + writer.WritePropertyName("subnet"); + writer.WriteObjectValue(Subnet); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"); + writer.WriteNumberValue(Revision.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional displayName = default; + Optional connectedGateway = default; + Optional subnet = default; + Optional> portVif = default; + Optional status = default; + Optional provisioningState = default; + Optional revision = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("connectedGateway")) + { + connectedGateway = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("subnet")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + subnet = WorkloadNetworkSegmentSubnet.DeserializeWorkloadNetworkSegmentSubnet(property0.Value); + continue; + } + if (property0.NameEquals("portVif")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkSegmentPortVif.DeserializeWorkloadNetworkSegmentPortVif(item)); + } + portVif = array; + continue; + } + if (property0.NameEquals("status")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new SegmentStatusEnum(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new WorkloadNetworkSegmentProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("revision")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + revision = property0.Value.GetInt64(); + continue; + } + } + continue; + } + } + return new WorkloadNetworkSegmentData(id, name, type, displayName.Value, connectedGateway.Value, subnet.Value, Optional.ToList(portVif), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.Serialization.cs new file mode 100644 index 000000000000..43aa7ae72b15 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkSegmentPortVif + { + internal static WorkloadNetworkSegmentPortVif DeserializeWorkloadNetworkSegmentPortVif(JsonElement element) + { + Optional portName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("portName")) + { + portName = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkSegmentPortVif(portName.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs new file mode 100644 index 000000000000..603255c99318 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentPortVif.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Avs.Models +{ + /// Ports and any VIF attached to segment. + public partial class WorkloadNetworkSegmentPortVif + { + /// Initializes a new instance of WorkloadNetworkSegmentPortVif. + internal WorkloadNetworkSegmentPortVif() + { + } + + /// Initializes a new instance of WorkloadNetworkSegmentPortVif. + /// Name of port or VIF attached to segment. + internal WorkloadNetworkSegmentPortVif(string portName) + { + PortName = portName; + } + + /// Name of port or VIF attached to segment. + public string PortName { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentProvisioningState.cs new file mode 100644 index 000000000000..9c972b8f6a66 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The provisioning state. + public readonly partial struct WorkloadNetworkSegmentProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WorkloadNetworkSegmentProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static WorkloadNetworkSegmentProvisioningState Succeeded { get; } = new WorkloadNetworkSegmentProvisioningState(SucceededValue); + /// Failed. + public static WorkloadNetworkSegmentProvisioningState Failed { get; } = new WorkloadNetworkSegmentProvisioningState(FailedValue); + /// Building. + public static WorkloadNetworkSegmentProvisioningState Building { get; } = new WorkloadNetworkSegmentProvisioningState(BuildingValue); + /// Deleting. + public static WorkloadNetworkSegmentProvisioningState Deleting { get; } = new WorkloadNetworkSegmentProvisioningState(DeletingValue); + /// Updating. + public static WorkloadNetworkSegmentProvisioningState Updating { get; } = new WorkloadNetworkSegmentProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(WorkloadNetworkSegmentProvisioningState left, WorkloadNetworkSegmentProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WorkloadNetworkSegmentProvisioningState left, WorkloadNetworkSegmentProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator WorkloadNetworkSegmentProvisioningState(string value) => new WorkloadNetworkSegmentProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WorkloadNetworkSegmentProvisioningState other && Equals(other); + /// + public bool Equals(WorkloadNetworkSegmentProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.Serialization.cs new file mode 100644 index 000000000000..e1676fbf5c46 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkSegmentSubnet : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(DhcpRanges)) + { + writer.WritePropertyName("dhcpRanges"); + writer.WriteStartArray(); + foreach (var item in DhcpRanges) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(GatewayAddress)) + { + writer.WritePropertyName("gatewayAddress"); + writer.WriteStringValue(GatewayAddress); + } + writer.WriteEndObject(); + } + + internal static WorkloadNetworkSegmentSubnet DeserializeWorkloadNetworkSegmentSubnet(JsonElement element) + { + Optional> dhcpRanges = default; + Optional gatewayAddress = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dhcpRanges")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dhcpRanges = array; + continue; + } + if (property.NameEquals("gatewayAddress")) + { + gatewayAddress = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkSegmentSubnet(Optional.ToList(dhcpRanges), gatewayAddress.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs new file mode 100644 index 000000000000..db7bfe7acb87 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentSubnet.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// Subnet configuration for segment. + public partial class WorkloadNetworkSegmentSubnet + { + /// Initializes a new instance of WorkloadNetworkSegmentSubnet. + public WorkloadNetworkSegmentSubnet() + { + DhcpRanges = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkSegmentSubnet. + /// DHCP Range assigned for subnet. + /// Gateway address. + internal WorkloadNetworkSegmentSubnet(IList dhcpRanges, string gatewayAddress) + { + DhcpRanges = dhcpRanges; + GatewayAddress = gatewayAddress; + } + + /// DHCP Range assigned for subnet. + public IList DhcpRanges { get; } + /// Gateway address. + public string GatewayAddress { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs new file mode 100644 index 000000000000..53f1006361cf --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class WorkloadNetworkSegmentsList + { + internal static WorkloadNetworkSegmentsList DeserializeWorkloadNetworkSegmentsList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkSegmentsList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs new file mode 100644 index 000000000000..e2ee4ad25dcf --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Avs; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of NSX Segments. + internal partial class WorkloadNetworkSegmentsList + { + /// Initializes a new instance of WorkloadNetworkSegmentsList. + internal WorkloadNetworkSegmentsList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkSegmentsList. + /// The items on the page. + /// URL to get the next page if any. + internal WorkloadNetworkSegmentsList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.Serialization.cs new file mode 100644 index 000000000000..c3de138840ce --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.Serialization.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkVMGroup : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsCollectionDefined(Members)) + { + writer.WritePropertyName("members"); + writer.WriteStartArray(); + foreach (var item in Members) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Revision)) + { + writer.WritePropertyName("revision"); + writer.WriteNumberValue(Revision.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WorkloadNetworkVMGroup DeserializeWorkloadNetworkVMGroup(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional displayName = default; + Optional> members = default; + Optional status = default; + Optional provisioningState = default; + Optional revision = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("members")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + members = array; + continue; + } + if (property0.NameEquals("status")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new VMGroupStatusEnum(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("provisioningState")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + provisioningState = new WorkloadNetworkVMGroupProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("revision")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + revision = property0.Value.GetInt64(); + continue; + } + } + continue; + } + } + return new WorkloadNetworkVMGroup(id, name, type, displayName.Value, Optional.ToList(members), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs new file mode 100644 index 000000000000..e630d8593563 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX VM Group. + public partial class WorkloadNetworkVMGroup : Resource + { + /// Initializes a new instance of WorkloadNetworkVMGroup. + public WorkloadNetworkVMGroup() + { + Members = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkVMGroup. + /// The id. + /// The name. + /// The type. + /// Display name of the VM group. + /// Virtual machine members of this group. + /// VM Group status. + /// The provisioning state. + /// NSX revision number. + internal WorkloadNetworkVMGroup(ResourceIdentifier id, string name, ResourceType type, string displayName, IList members, VMGroupStatusEnum? status, WorkloadNetworkVMGroupProvisioningState? provisioningState, long? revision) : base(id, name, type) + { + DisplayName = displayName; + Members = members; + Status = status; + ProvisioningState = provisioningState; + Revision = revision; + } + + /// Display name of the VM group. + public string DisplayName { get; set; } + /// Virtual machine members of this group. + public IList Members { get; } + /// VM Group status. + public VMGroupStatusEnum? Status { get; } + /// The provisioning state. + public WorkloadNetworkVMGroupProvisioningState? ProvisioningState { get; } + /// NSX revision number. + public long? Revision { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupProvisioningState.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupProvisioningState.cs new file mode 100644 index 000000000000..2d59627bc0c5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Avs.Models +{ + /// The provisioning state. + public readonly partial struct WorkloadNetworkVMGroupProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WorkloadNetworkVMGroupProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string BuildingValue = "Building"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + + /// Succeeded. + public static WorkloadNetworkVMGroupProvisioningState Succeeded { get; } = new WorkloadNetworkVMGroupProvisioningState(SucceededValue); + /// Failed. + public static WorkloadNetworkVMGroupProvisioningState Failed { get; } = new WorkloadNetworkVMGroupProvisioningState(FailedValue); + /// Building. + public static WorkloadNetworkVMGroupProvisioningState Building { get; } = new WorkloadNetworkVMGroupProvisioningState(BuildingValue); + /// Deleting. + public static WorkloadNetworkVMGroupProvisioningState Deleting { get; } = new WorkloadNetworkVMGroupProvisioningState(DeletingValue); + /// Updating. + public static WorkloadNetworkVMGroupProvisioningState Updating { get; } = new WorkloadNetworkVMGroupProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(WorkloadNetworkVMGroupProvisioningState left, WorkloadNetworkVMGroupProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WorkloadNetworkVMGroupProvisioningState left, WorkloadNetworkVMGroupProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator WorkloadNetworkVMGroupProvisioningState(string value) => new WorkloadNetworkVMGroupProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WorkloadNetworkVMGroupProvisioningState other && Equals(other); + /// + public bool Equals(WorkloadNetworkVMGroupProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.Serialization.cs new file mode 100644 index 000000000000..a2972fd6a471 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class WorkloadNetworkVMGroupsList + { + internal static WorkloadNetworkVMGroupsList DeserializeWorkloadNetworkVMGroupsList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkVMGroupsList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.cs new file mode 100644 index 000000000000..71e58fe257f9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of NSX VM Groups. + internal partial class WorkloadNetworkVMGroupsList + { + /// Initializes a new instance of WorkloadNetworkVMGroupsList. + internal WorkloadNetworkVMGroupsList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkVMGroupsList. + /// The items on the page. + /// URL to get the next page if any. + internal WorkloadNetworkVMGroupsList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.Serialization.cs new file mode 100644 index 000000000000..cc261fc70a09 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.Serialization.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Avs.Models +{ + public partial class WorkloadNetworkVirtualMachine : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static WorkloadNetworkVirtualMachine DeserializeWorkloadNetworkVirtualMachine(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional displayName = default; + Optional vmType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("vmType")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + vmType = new VMTypeEnum(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new WorkloadNetworkVirtualMachine(id, name, type, displayName.Value, Optional.ToNullable(vmType)); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs new file mode 100644 index 000000000000..36a58f0e21bb --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs.Models +{ + /// NSX Virtual Machine. + public partial class WorkloadNetworkVirtualMachine : Resource + { + /// Initializes a new instance of WorkloadNetworkVirtualMachine. + public WorkloadNetworkVirtualMachine() + { + } + + /// Initializes a new instance of WorkloadNetworkVirtualMachine. + /// The id. + /// The name. + /// The type. + /// Display name of the VM. + /// Virtual machine type. + internal WorkloadNetworkVirtualMachine(ResourceIdentifier id, string name, ResourceType type, string displayName, VMTypeEnum? vmType) : base(id, name, type) + { + DisplayName = displayName; + VmType = vmType; + } + + /// Display name of the VM. + public string DisplayName { get; set; } + /// Virtual machine type. + public VMTypeEnum? VmType { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs new file mode 100644 index 000000000000..8a434572fa26 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + internal partial class WorkloadNetworkVirtualMachinesList + { + internal static WorkloadNetworkVirtualMachinesList DeserializeWorkloadNetworkVirtualMachinesList(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadNetworkVirtualMachine.DeserializeWorkloadNetworkVirtualMachine(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new WorkloadNetworkVirtualMachinesList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs new file mode 100644 index 000000000000..89b2094dacc4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Avs.Models +{ + /// A list of NSX Virtual Machines. + internal partial class WorkloadNetworkVirtualMachinesList + { + /// Initializes a new instance of WorkloadNetworkVirtualMachinesList. + internal WorkloadNetworkVirtualMachinesList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkVirtualMachinesList. + /// The items on the page. + /// URL to get the next page if any. + internal WorkloadNetworkVirtualMachinesList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The items on the page. + public IReadOnlyList Value { get; } + /// URL to get the next page if any. + public string NextLink { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicy.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicy.cs new file mode 100644 index 000000000000..065ce13e1da1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicy.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a PlacementPolicy along with the instance operations that can be performed on it. + public partial class PlacementPolicy : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly PlacementPoliciesRestOperations _restClient; + private readonly PlacementPolicyData _data; + + /// Initializes a new instance of the class for mocking. + protected PlacementPolicy() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PlacementPolicy(ArmResource options, PlacementPolicyData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal PlacementPolicy(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal PlacementPolicy(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters/placementPolicies"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PlacementPolicyData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get a placement policy by name in a private cloud cluster. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicy.Get"); + scope.Start(); + try + { + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new PlacementPolicy(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a placement policy by name in a private cloud cluster. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicy.Get"); + scope.Start(); + try + { + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PlacementPolicy(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Delete a placement policy in a private cloud cluster. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicy.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new PlacementPolicyDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a placement policy in a private cloud cluster. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual PlacementPolicyDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicy.Delete"); + scope.Start(); + try + { + var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new PlacementPolicyDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update a placement policy in a private cloud cluster. + /// The placement policy properties that may be updated. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateAsync(PlacementPolicyUpdate placementPolicyUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (placementPolicyUpdate == null) + { + throw new ArgumentNullException(nameof(placementPolicyUpdate)); + } + + using var scope = _clientDiagnostics.CreateScope("PlacementPolicy.Update"); + scope.Start(); + try + { + var response = await _restClient.UpdateAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate, cancellationToken).ConfigureAwait(false); + var operation = new PlacementPolicyUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update a placement policy in a private cloud cluster. + /// The placement policy properties that may be updated. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual PlacementPolicyUpdateOperation Update(PlacementPolicyUpdate placementPolicyUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (placementPolicyUpdate == null) + { + throw new ArgumentNullException(nameof(placementPolicyUpdate)); + } + + using var scope = _clientDiagnostics.CreateScope("PlacementPolicy.Update"); + scope.Start(); + try + { + var response = _restClient.Update(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate, cancellationToken); + var operation = new PlacementPolicyUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs new file mode 100644 index 000000000000..20fe984472e4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of PlacementPolicy and their operations over a Cluster. + public partial class PlacementPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly PlacementPoliciesRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected PlacementPolicyCollection() + { + } + + /// Initializes a new instance of PlacementPolicyCollection class. + /// The resource representing the parent resource. + internal PlacementPolicyCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => Cluster.ResourceType; + + // Collection level operations. + + /// Create or update a placement policy in a private cloud cluster. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// A placement policy in the private cloud cluster. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual PlacementPolicyCreateOrUpdateOperation CreateOrUpdate(string placementPolicyName, PlacementPolicyData placementPolicy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + if (placementPolicy == null) + { + throw new ArgumentNullException(nameof(placementPolicy)); + } + + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy, cancellationToken); + var operation = new PlacementPolicyCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a placement policy in a private cloud cluster. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// A placement policy in the private cloud cluster. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string placementPolicyName, PlacementPolicyData placementPolicy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + if (placementPolicy == null) + { + throw new ArgumentNullException(nameof(placementPolicy)); + } + + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy, cancellationToken).ConfigureAwait(false); + var operation = new PlacementPolicyCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string placementPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.Get"); + scope.Start(); + try + { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PlacementPolicy(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string placementPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.Get"); + scope.Start(); + try + { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new PlacementPolicy(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string placementPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.GetIfExists"); + scope.Start(); + try + { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new PlacementPolicy(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string placementPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.GetIfExists"); + scope.Start(); + try + { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new PlacementPolicy(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string placementPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.CheckIfExists"); + scope.Start(); + try + { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + var response = GetIfExists(placementPolicyName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string placementPolicyName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.CheckIfExists"); + scope.Start(); + try + { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + var response = await GetIfExistsAsync(placementPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List placement policies in a private cloud cluster. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAll(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new PlacementPolicy(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new PlacementPolicy(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List placement policies in a private cloud cluster. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new PlacementPolicy(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new PlacementPolicy(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs new file mode 100644 index 000000000000..1a292ab88d93 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the PlacementPolicy data model. + public partial class PlacementPolicyData : Resource + { + /// Initializes a new instance of PlacementPolicyData. + public PlacementPolicyData() + { + } + + /// Initializes a new instance of PlacementPolicyData. + /// The id. + /// The name. + /// The type. + /// placement policy properties. + internal PlacementPolicyData(ResourceIdentifier id, string name, ResourceType type, PlacementPolicyProperties properties) : base(id, name, type) + { + Properties = properties; + } + + /// placement policy properties. + public PlacementPolicyProperties Properties { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs new file mode 100644 index 000000000000..d3c5fbcb75d9 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs @@ -0,0 +1,712 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a PrivateCloud along with the instance operations that can be performed on it. + public partial class PrivateCloud : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly PrivateCloudsRestOperations _restClient; + private readonly PrivateCloudData _data; + private ScriptPackagesRestOperations _scriptPackagesRestClient { get; } + + /// Initializes a new instance of the class for mocking. + protected PrivateCloud() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal PrivateCloud(ArmResource options, PrivateCloudData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal PrivateCloud(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal PrivateCloud(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual PrivateCloudData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Get"); + scope.Start(); + try + { + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new PrivateCloud(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Get"); + scope.Start(); + try + { + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PrivateCloud(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Delete a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new PrivateCloudDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual PrivateCloudDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Delete"); + scope.Start(); + try + { + var response = _restClient.Delete(Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new PrivateCloudDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// The updated resource with the tag added. + public async virtual Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + if (string.IsNullOrWhiteSpace(key)) + { + throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.AddTag"); + scope.Start(); + try + { + var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.Properties.TagsValue[key] = value; + await TagResource.CreateOrUpdateAsync(originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Add a tag to the current resource. + /// The key for the tag. + /// The value for the tag. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// The updated resource with the tag added. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + if (string.IsNullOrWhiteSpace(key)) + { + throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.AddTag"); + scope.Start(); + try + { + var originalTags = TagResource.Get(cancellationToken); + originalTags.Value.Data.Properties.TagsValue[key] = value; + TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _restClient.Get(Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The set of tags to use as replacement. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// The updated resource with the tags replaced. + public async virtual Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + if (tags == null) + { + throw new ArgumentNullException($"{nameof(tags)} provided cannot be null.", nameof(tags)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.SetTags"); + scope.Start(); + try + { + await TagResource.DeleteAsync(cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); + await TagResource.CreateOrUpdateAsync(originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Replace the tags on the resource with the given set. + /// The set of tags to use as replacement. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// The updated resource with the tags replaced. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + if (tags == null) + { + throw new ArgumentNullException($"{nameof(tags)} provided cannot be null.", nameof(tags)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.SetTags"); + scope.Start(); + try + { + TagResource.Delete(cancellationToken: cancellationToken); + var originalTags = TagResource.Get(cancellationToken); + originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); + TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _restClient.Get(Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key of the tag to remove. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// The updated resource with the tag removed. + public async virtual Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + if (string.IsNullOrWhiteSpace(key)) + { + throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RemoveTag"); + scope.Start(); + try + { + var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.Properties.TagsValue.Remove(key); + await TagResource.CreateOrUpdateAsync(originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Removes a tag by key from the resource. + /// The key of the tag to remove. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// The updated resource with the tag removed. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + if (string.IsNullOrWhiteSpace(key)) + { + throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RemoveTag"); + scope.Start(); + try + { + var originalTags = TagResource.Get(cancellationToken); + originalTags.Value.Data.Properties.TagsValue.Remove(key); + TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _restClient.Get(Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// List the admin credentials for the private cloud. + /// The cancellation token to use. + public virtual async Task> GetAdminCredentialsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetAdminCredentials"); + scope.Start(); + try + { + var response = await _restClient.GetAdminCredentialsAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List the admin credentials for the private cloud. + /// The cancellation token to use. + public virtual Response GetAdminCredentials(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetAdminCredentials"); + scope.Start(); + try + { + var response = _restClient.GetAdminCredentials(Id.ResourceGroupName, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a script package available to run on a private cloud. + /// The cancellation token to use. + public virtual async Task> GetScriptPackageAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackage"); + scope.Start(); + try + { + var response = await _scriptPackagesRestClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a script package available to run on a private cloud. + /// The cancellation token to use. + public virtual Response GetScriptPackage(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackage"); + scope.Start(); + try + { + var response = _scriptPackagesRestClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List script packages available to run on the private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScriptPackages(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackages"); + scope.Start(); + try + { + var response = _scriptPackagesRestClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackages"); + scope.Start(); + try + { + var response = _scriptPackagesRestClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List script packages available to run on the private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScriptPackagesAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackages"); + scope.Start(); + try + { + var response = await _scriptPackagesRestClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackages"); + scope.Start(); + try + { + var response = await _scriptPackagesRestClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Update a private cloud. + /// The private cloud properties to be updated. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateAsync(PrivateCloudUpdate privateCloudUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (privateCloudUpdate == null) + { + throw new ArgumentNullException(nameof(privateCloudUpdate)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Update"); + scope.Start(); + try + { + var response = await _restClient.UpdateAsync(Id.ResourceGroupName, Id.Name, privateCloudUpdate, cancellationToken).ConfigureAwait(false); + var operation = new PrivateCloudUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Name, privateCloudUpdate).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Update a private cloud. + /// The private cloud properties to be updated. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual PrivateCloudUpdateOperation Update(PrivateCloudUpdate privateCloudUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (privateCloudUpdate == null) + { + throw new ArgumentNullException(nameof(privateCloudUpdate)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Update"); + scope.Start(); + try + { + var response = _restClient.Update(Id.ResourceGroupName, Id.Name, privateCloudUpdate, cancellationToken); + var operation = new PrivateCloudUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Name, privateCloudUpdate).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Rotate the vCenter password. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task RotateVcenterPasswordAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateVcenterPassword"); + scope.Start(); + try + { + var response = await _restClient.RotateVcenterPasswordAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new PrivateCloudRotateVcenterPasswordOperation(_clientDiagnostics, Pipeline, _restClient.CreateRotateVcenterPasswordRequest(Id.ResourceGroupName, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Rotate the vCenter password. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual PrivateCloudRotateVcenterPasswordOperation RotateVcenterPassword(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateVcenterPassword"); + scope.Start(); + try + { + var response = _restClient.RotateVcenterPassword(Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new PrivateCloudRotateVcenterPasswordOperation(_clientDiagnostics, Pipeline, _restClient.CreateRotateVcenterPasswordRequest(Id.ResourceGroupName, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Rotate the NSX-T Manager password. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task RotateNsxtPasswordAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateNsxtPassword"); + scope.Start(); + try + { + var response = await _restClient.RotateNsxtPasswordAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new PrivateCloudRotateNsxtPasswordOperation(_clientDiagnostics, Pipeline, _restClient.CreateRotateNsxtPasswordRequest(Id.ResourceGroupName, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Rotate the NSX-T Manager password. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual PrivateCloudRotateNsxtPasswordOperation RotateNsxtPassword(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateNsxtPassword"); + scope.Start(); + try + { + var response = _restClient.RotateNsxtPassword(Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new PrivateCloudRotateNsxtPasswordOperation(_clientDiagnostics, Pipeline, _restClient.CreateRotateNsxtPasswordRequest(Id.ResourceGroupName, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a list of Clusters in the PrivateCloud. + /// An object representing collection of Clusters and their operations over a PrivateCloud. + public ClusterCollection GetClusters() + { + return new ClusterCollection(this); + } + + /// Gets a list of HcxEnterpriseSites in the PrivateCloud. + /// An object representing collection of HcxEnterpriseSites and their operations over a PrivateCloud. + public HcxEnterpriseSiteCollection GetHcxEnterpriseSites() + { + return new HcxEnterpriseSiteCollection(this); + } + + /// Gets a list of ExpressRouteAuthorizations in the PrivateCloud. + /// An object representing collection of ExpressRouteAuthorizations and their operations over a PrivateCloud. + public ExpressRouteAuthorizationCollection GetExpressRouteAuthorizations() + { + return new ExpressRouteAuthorizationCollection(this); + } + + /// Gets a list of GlobalReachConnections in the PrivateCloud. + /// An object representing collection of GlobalReachConnections and their operations over a PrivateCloud. + public GlobalReachConnectionCollection GetGlobalReachConnections() + { + return new GlobalReachConnectionCollection(this); + } + + /// Gets a list of WorkloadNetworkSegments in the PrivateCloud. + /// An object representing collection of WorkloadNetworkSegments and their operations over a PrivateCloud. + public WorkloadNetworkSegmentCollection GetWorkloadNetworkSegments() + { + return new WorkloadNetworkSegmentCollection(this); + } + + /// Gets a list of CloudLinks in the PrivateCloud. + /// An object representing collection of CloudLinks and their operations over a PrivateCloud. + public CloudLinkCollection GetCloudLinks() + { + return new CloudLinkCollection(this); + } + + /// Gets a list of Addons in the PrivateCloud. + /// An object representing collection of Addons and their operations over a PrivateCloud. + public AddonCollection GetAddons() + { + return new AddonCollection(this); + } + + /// Gets a list of ScriptExecutions in the PrivateCloud. + /// An object representing collection of ScriptExecutions and their operations over a PrivateCloud. + public ScriptExecutionCollection GetScriptExecutions() + { + return new ScriptExecutionCollection(this); + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs new file mode 100644 index 000000000000..3a92dd00b50d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs @@ -0,0 +1,408 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of PrivateCloud and their operations over a ResourceGroup. + public partial class PrivateCloudCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly PrivateCloudsRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected PrivateCloudCollection() + { + } + + /// Initializes a new instance of PrivateCloudCollection class. + /// The resource representing the parent resource. + internal PrivateCloudCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => ResourceGroup.ResourceType; + + // Collection level operations. + + /// Create or update a private cloud. + /// Name of the private cloud. + /// The private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual PrivateCloudCreateOrUpdateOperation CreateOrUpdate(string privateCloudName, PrivateCloudData privateCloud, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (privateCloud == null) + { + throw new ArgumentNullException(nameof(privateCloud)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, privateCloudName, privateCloud, cancellationToken); + var operation = new PrivateCloudCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, privateCloudName, privateCloud).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a private cloud. + /// Name of the private cloud. + /// The private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string privateCloudName, PrivateCloudData privateCloud, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (privateCloud == null) + { + throw new ArgumentNullException(nameof(privateCloud)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, privateCloudName, privateCloud, cancellationToken).ConfigureAwait(false); + var operation = new PrivateCloudCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, privateCloudName, privateCloud).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string privateCloudName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.Get"); + scope.Start(); + try + { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new PrivateCloud(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string privateCloudName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.Get"); + scope.Start(); + try + { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new PrivateCloud(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string privateCloudName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.GetIfExists"); + scope.Start(); + try + { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new PrivateCloud(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string privateCloudName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.GetIfExists"); + scope.Start(); + try + { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new PrivateCloud(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string privateCloudName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.CheckIfExists"); + scope.Start(); + try + { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + var response = GetIfExists(privateCloudName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the private cloud. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string privateCloudName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.CheckIfExists"); + scope.Start(); + try + { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + var response = await GetIfExistsAsync(privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List private clouds in a resource group. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAll(Id.ResourceGroupName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List private clouds in a resource group. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllAsync(Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Filters the list of for this resource group represented as generic resources. + /// The filter used in this operation. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. + /// The number of results to return. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of resource that may take multiple service requests to iterate over. + public virtual Pageable GetAllAsGenericResources(string nameFilter, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.GetAllAsGenericResources"); + scope.Start(); + try + { + var filters = new ResourceFilterCollection(PrivateCloud.ResourceType); + filters.SubstringFilter = nameFilter; + return ResourceListOperations.GetAtContext(Parent as ResourceGroup, filters, expand, top, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Filters the list of for this resource group represented as generic resources. + /// The filter used in this operation. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. + /// The number of results to return. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// An async collection of resource that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsGenericResourcesAsync(string nameFilter, string expand = null, int? top = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.GetAllAsGenericResources"); + scope.Start(); + try + { + var filters = new ResourceFilterCollection(PrivateCloud.ResourceType); + filters.SubstringFilter = nameFilter; + return ResourceListOperations.GetAtContextAsync(Parent as ResourceGroup, filters, expand, top, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs new file mode 100644 index 000000000000..252c9ec04a7b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the PrivateCloud data model. + public partial class PrivateCloudData : TrackedResource + { + /// Initializes a new instance of PrivateCloudData. + /// The location. + /// The private cloud SKU. + /// is null. + public PrivateCloudData(Location location, Models.Sku sku) : base(location) + { + if (sku == null) + { + throw new ArgumentNullException(nameof(sku)); + } + + Sku = sku; + IdentitySources = new ChangeTrackingList(); + ExternalCloudLinks = new ChangeTrackingList(); + } + + /// Initializes a new instance of PrivateCloudData. + /// The id. + /// The name. + /// The type. + /// The tags. + /// The location. + /// The private cloud SKU. + /// The identity of the private cloud, if configured. + /// The default cluster used for management. + /// Connectivity to internet is enabled or disabled. + /// vCenter Single Sign On Identity Sources. + /// Properties describing how the cloud is distributed across availability zones. + /// Customer managed key encryption, can be enabled or disabled. + /// The provisioning state. + /// An ExpressRoute Circuit. + /// The endpoints. + /// The block of addresses should be unique across VNet in your subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are between 0 and 255, and X is between 0 and 22. + /// Network used to access vCenter Server and NSX-T Manager. + /// Used for virtual machine cold migration, cloning, and snapshot migration. + /// Used for live migration of virtual machines. + /// Optionally, set the vCenter admin password when the private cloud is created. + /// Optionally, set the NSX-T Manager password when the private cloud is created. + /// Thumbprint of the vCenter Server SSL certificate. + /// Thumbprint of the NSX-T Manager SSL certificate. + /// Array of cloud link IDs from other clouds that connect to this one. + /// A secondary expressRoute circuit from a separate AZ. Only present in a stretched private cloud. + internal PrivateCloudData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, Models.Sku sku, PrivateCloudIdentity identity, ManagementCluster managementCluster, InternetEnum? internet, IList identitySources, AvailabilityProperties availability, Encryption encryption, PrivateCloudProvisioningState? provisioningState, Circuit circuit, Endpoints endpoints, string networkBlock, string managementNetwork, string provisioningNetwork, string vmotionNetwork, string vcenterPassword, string nsxtPassword, string vcenterCertificateThumbprint, string nsxtCertificateThumbprint, IReadOnlyList externalCloudLinks, Circuit secondaryCircuit) : base(id, name, type, tags, location) + { + Sku = sku; + Identity = identity; + ManagementCluster = managementCluster; + Internet = internet; + IdentitySources = identitySources; + Availability = availability; + Encryption = encryption; + ProvisioningState = provisioningState; + Circuit = circuit; + Endpoints = endpoints; + NetworkBlock = networkBlock; + ManagementNetwork = managementNetwork; + ProvisioningNetwork = provisioningNetwork; + VmotionNetwork = vmotionNetwork; + VcenterPassword = vcenterPassword; + NsxtPassword = nsxtPassword; + VcenterCertificateThumbprint = vcenterCertificateThumbprint; + NsxtCertificateThumbprint = nsxtCertificateThumbprint; + ExternalCloudLinks = externalCloudLinks; + SecondaryCircuit = secondaryCircuit; + } + + /// The private cloud SKU. + public Models.Sku Sku { get; set; } + /// The identity of the private cloud, if configured. + public PrivateCloudIdentity Identity { get; set; } + /// The default cluster used for management. + public ManagementCluster ManagementCluster { get; set; } + /// Connectivity to internet is enabled or disabled. + public InternetEnum? Internet { get; set; } + /// vCenter Single Sign On Identity Sources. + public IList IdentitySources { get; } + /// Properties describing how the cloud is distributed across availability zones. + public AvailabilityProperties Availability { get; set; } + /// Customer managed key encryption, can be enabled or disabled. + public Encryption Encryption { get; set; } + /// The provisioning state. + public PrivateCloudProvisioningState? ProvisioningState { get; } + /// An ExpressRoute Circuit. + public Circuit Circuit { get; set; } + /// The endpoints. + public Endpoints Endpoints { get; } + /// The block of addresses should be unique across VNet in your subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are between 0 and 255, and X is between 0 and 22. + public string NetworkBlock { get; set; } + /// Network used to access vCenter Server and NSX-T Manager. + public string ManagementNetwork { get; } + /// Used for virtual machine cold migration, cloning, and snapshot migration. + public string ProvisioningNetwork { get; } + /// Used for live migration of virtual machines. + public string VmotionNetwork { get; } + /// Optionally, set the vCenter admin password when the private cloud is created. + public string VcenterPassword { get; set; } + /// Optionally, set the NSX-T Manager password when the private cloud is created. + public string NsxtPassword { get; set; } + /// Thumbprint of the vCenter Server SSL certificate. + public string VcenterCertificateThumbprint { get; } + /// Thumbprint of the NSX-T Manager SSL certificate. + public string NsxtCertificateThumbprint { get; } + /// Array of cloud link IDs from other clouds that connect to this one. + public IReadOnlyList ExternalCloudLinks { get; } + /// A secondary expressRoute circuit from a separate AZ. Only present in a stretched private cloud. + public Circuit SecondaryCircuit { get; set; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs new file mode 100644 index 000000000000..02438f087f7e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class AddonsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of AddonsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public AddonsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/addons", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List addons in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AddonList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AddonList.DeserializeAddonList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List addons in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AddonList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AddonList.DeserializeAddonList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string addonName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/addons/", false); + uri.AppendPath(addonName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get an addon by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the addon for the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, addonName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AddonData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AddonData.DeserializeAddonData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AddonData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get an addon by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the addon for the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, addonName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AddonData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AddonData.DeserializeAddonData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AddonData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string addonName, AddonData addon) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/addons/", false); + uri.AppendPath(addonName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(addon); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a addon in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the addon for the private cloud. + /// A addon in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string addonName, AddonData addon, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + if (addon == null) + { + throw new ArgumentNullException(nameof(addon)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, addonName, addon); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a addon in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the addon for the private cloud. + /// A addon in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string addonName, AddonData addon, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + if (addon == null) + { + throw new ArgumentNullException(nameof(addon)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, addonName, addon); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string addonName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/addons/", false); + uri.AppendPath(addonName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a addon in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the addon for the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, addonName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a addon in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the addon for the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, addonName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List addons in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AddonList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AddonList.DeserializeAddonList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List addons in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AddonList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AddonList.DeserializeAddonList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs new file mode 100644 index 000000000000..0dcd6a57b69f --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class AuthorizationsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of AuthorizationsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public AuthorizationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/authorizations", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List ExpressRoute Circuit Authorizations in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ExpressRouteAuthorizationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ExpressRouteAuthorizationList.DeserializeExpressRouteAuthorizationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List ExpressRoute Circuit Authorizations in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ExpressRouteAuthorizationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ExpressRouteAuthorizationList.DeserializeExpressRouteAuthorizationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string authorizationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get an ExpressRoute Circuit Authorization by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, authorizationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ExpressRouteAuthorizationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ExpressRouteAuthorizationData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get an ExpressRoute Circuit Authorization by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, authorizationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ExpressRouteAuthorizationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ExpressRouteAuthorizationData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorizationData authorization) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(authorization); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update an ExpressRoute Circuit Authorization in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// An ExpressRoute Circuit Authorization. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorizationData authorization, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + if (authorization == null) + { + throw new ArgumentNullException(nameof(authorization)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, authorizationName, authorization); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an ExpressRoute Circuit Authorization in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// An ExpressRoute Circuit Authorization. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorizationData authorization, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + if (authorization == null) + { + throw new ArgumentNullException(nameof(authorization)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, authorizationName, authorization); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string authorizationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/authorizations/", false); + uri.AppendPath(authorizationName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete an ExpressRoute Circuit Authorization in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, authorizationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete an ExpressRoute Circuit Authorization in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the ExpressRoute Circuit Authorization in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, authorizationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List ExpressRoute Circuit Authorizations in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ExpressRouteAuthorizationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ExpressRouteAuthorizationList.DeserializeExpressRouteAuthorizationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List ExpressRoute Circuit Authorizations in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ExpressRouteAuthorizationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ExpressRouteAuthorizationList.DeserializeExpressRouteAuthorizationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs new file mode 100644 index 000000000000..39ae2fce3910 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class CloudLinksRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of CloudLinksRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public CloudLinksRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/cloudLinks", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List cloud link in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CloudLinkList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CloudLinkList.DeserializeCloudLinkList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List cloud link in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CloudLinkList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CloudLinkList.DeserializeCloudLinkList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string cloudLinkName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/cloudLinks/", false); + uri.AppendPath(cloudLinkName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get an cloud link by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cloud link resource. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, cloudLinkName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CloudLinkData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CloudLinkData.DeserializeCloudLinkData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((CloudLinkData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get an cloud link by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cloud link resource. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, cloudLinkName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CloudLinkData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CloudLinkData.DeserializeCloudLinkData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((CloudLinkData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData cloudLink) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/cloudLinks/", false); + uri.AppendPath(cloudLinkName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(cloudLink); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a cloud link in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the cloud link resource. + /// A cloud link in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData cloudLink, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + if (cloudLink == null) + { + throw new ArgumentNullException(nameof(cloudLink)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, cloudLinkName, cloudLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a cloud link in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the cloud link resource. + /// A cloud link in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData cloudLink, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + if (cloudLink == null) + { + throw new ArgumentNullException(nameof(cloudLink)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, cloudLinkName, cloudLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string cloudLinkName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/cloudLinks/", false); + uri.AppendPath(cloudLinkName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a cloud link in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cloud link resource. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, cloudLinkName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a cloud link in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cloud link resource. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, cloudLinkName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List cloud link in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CloudLinkList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CloudLinkList.DeserializeCloudLinkList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List cloud link in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CloudLinkList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CloudLinkList.DeserializeCloudLinkList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs new file mode 100644 index 000000000000..6ca8193efecd --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs @@ -0,0 +1,614 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class ClustersRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of ClustersRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public ClustersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List clusters in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ClusterList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ClusterList.DeserializeClusterList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List clusters in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ClusterList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ClusterList.DeserializeClusterList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a cluster by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ClusterData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ClusterData.DeserializeClusterData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ClusterData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a cluster by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ClusterData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ClusterData.DeserializeClusterData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ClusterData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string clusterName, ClusterData cluster) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(cluster); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a cluster in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the cluster in the private cloud. + /// A cluster in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string clusterName, ClusterData cluster, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (cluster == null) + { + throw new ArgumentNullException(nameof(cluster)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, cluster); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a cluster in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the cluster in the private cloud. + /// A cluster in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string clusterName, ClusterData cluster, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (cluster == null) + { + throw new ArgumentNullException(nameof(cluster)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, cluster); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(clusterUpdate); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Update a cluster in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cluster properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateAsync(string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (clusterUpdate == null) + { + throw new ArgumentNullException(nameof(clusterUpdate)); + } + + using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, clusterName, clusterUpdate); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update a cluster in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cluster properties to be updated. + /// The cancellation token to use. + /// , , , or is null. + public Response Update(string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (clusterUpdate == null) + { + throw new ArgumentNullException(nameof(clusterUpdate)); + } + + using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, clusterName, clusterUpdate); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a cluster in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a cluster in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List clusters in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ClusterList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ClusterList.DeserializeClusterList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List clusters in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ClusterList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ClusterList.DeserializeClusterList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs new file mode 100644 index 000000000000..f83313a574eb --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs @@ -0,0 +1,570 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class DatastoresRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of DatastoresRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public DatastoresRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/datastores", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List datastores in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatastoreList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatastoreList.DeserializeDatastoreList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List datastores in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatastoreList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatastoreList.DeserializeDatastoreList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/datastores/", false); + uri.AppendPath(datastoreName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a datastore in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the datastore in the private cloud cluster. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, datastoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatastoreData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatastoreData.DeserializeDatastoreData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatastoreData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a datastore in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the datastore in the private cloud cluster. + /// The cancellation token to use. + /// , , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, datastoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatastoreData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatastoreData.DeserializeDatastoreData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatastoreData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData datastore) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/datastores/", false); + uri.AppendPath(datastoreName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(datastore); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a datastore in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the datastore in the private cloud cluster. + /// A datastore in a private cloud cluster. + /// The cancellation token to use. + /// , , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData datastore, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + if (datastore == null) + { + throw new ArgumentNullException(nameof(datastore)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, datastoreName, datastore); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a datastore in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the datastore in the private cloud cluster. + /// A datastore in a private cloud cluster. + /// The cancellation token to use. + /// , , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData datastore, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + if (datastore == null) + { + throw new ArgumentNullException(nameof(datastore)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, datastoreName, datastore); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/datastores/", false); + uri.AppendPath(datastoreName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a datastore in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the datastore in the private cloud cluster. + /// The cancellation token to use. + /// , , , or is null. + public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName, datastoreName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a datastore in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the datastore in the private cloud cluster. + /// The cancellation token to use. + /// , , , or is null. + public Response Delete(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName, datastoreName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List datastores in a private cloud cluster. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatastoreList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatastoreList.DeserializeDatastoreList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List datastores in a private cloud cluster. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatastoreList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatastoreList.DeserializeDatastoreList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs new file mode 100644 index 000000000000..6e159d714260 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class GlobalReachConnectionsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of GlobalReachConnectionsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public GlobalReachConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/globalReachConnections", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List global reach connections in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GlobalReachConnectionList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GlobalReachConnectionList.DeserializeGlobalReachConnectionList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List global reach connections in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GlobalReachConnectionList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GlobalReachConnectionList.DeserializeGlobalReachConnectionList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string globalReachConnectionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/globalReachConnections/", false); + uri.AppendPath(globalReachConnectionName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a global reach connection by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the global reach connection in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, globalReachConnectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GlobalReachConnectionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GlobalReachConnectionData.DeserializeGlobalReachConnectionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GlobalReachConnectionData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a global reach connection by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the global reach connection in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, globalReachConnectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GlobalReachConnectionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GlobalReachConnectionData.DeserializeGlobalReachConnectionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GlobalReachConnectionData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/globalReachConnections/", false); + uri.AppendPath(globalReachConnectionName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(globalReachConnection); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a global reach connection in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the global reach connection in the private cloud. + /// A global reach connection in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + if (globalReachConnection == null) + { + throw new ArgumentNullException(nameof(globalReachConnection)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a global reach connection in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the global reach connection in the private cloud. + /// A global reach connection in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + if (globalReachConnection == null) + { + throw new ArgumentNullException(nameof(globalReachConnection)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string globalReachConnectionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/globalReachConnections/", false); + uri.AppendPath(globalReachConnectionName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a global reach connection in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the global reach connection in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, globalReachConnectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a global reach connection in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the global reach connection in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, globalReachConnectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List global reach connections in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GlobalReachConnectionList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GlobalReachConnectionList.DeserializeGlobalReachConnectionList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List global reach connections in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GlobalReachConnectionList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GlobalReachConnectionList.DeserializeGlobalReachConnectionList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs new file mode 100644 index 000000000000..4d6037cef310 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs @@ -0,0 +1,520 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class HcxEnterpriseSitesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of HcxEnterpriseSitesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public HcxEnterpriseSitesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/hcxEnterpriseSites", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List HCX Enterprise Sites in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + HcxEnterpriseSiteList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = HcxEnterpriseSiteList.DeserializeHcxEnterpriseSiteList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List HCX Enterprise Sites in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + HcxEnterpriseSiteList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = HcxEnterpriseSiteList.DeserializeHcxEnterpriseSiteList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/hcxEnterpriseSites/", false); + uri.AppendPath(hcxEnterpriseSiteName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get an HCX Enterprise Site by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the HCX Enterprise Site in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + HcxEnterpriseSiteData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = HcxEnterpriseSiteData.DeserializeHcxEnterpriseSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((HcxEnterpriseSiteData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get an HCX Enterprise Site by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the HCX Enterprise Site in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + HcxEnterpriseSiteData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = HcxEnterpriseSiteData.DeserializeHcxEnterpriseSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((HcxEnterpriseSiteData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/hcxEnterpriseSites/", false); + uri.AppendPath(hcxEnterpriseSiteName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(hcxEnterpriseSite); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update an HCX Enterprise Site in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the HCX Enterprise Site in the private cloud. + /// The HCX Enterprise Site. + /// The cancellation token to use. + /// , , , or is null. + public async Task> CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + if (hcxEnterpriseSite == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSite)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName, hcxEnterpriseSite); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + HcxEnterpriseSiteData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = HcxEnterpriseSiteData.DeserializeHcxEnterpriseSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update an HCX Enterprise Site in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the HCX Enterprise Site in the private cloud. + /// The HCX Enterprise Site. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + if (hcxEnterpriseSite == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSite)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName, hcxEnterpriseSite); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + HcxEnterpriseSiteData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = HcxEnterpriseSiteData.DeserializeHcxEnterpriseSiteData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/hcxEnterpriseSites/", false); + uri.AppendPath(hcxEnterpriseSiteName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete an HCX Enterprise Site in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the HCX Enterprise Site in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete an HCX Enterprise Site in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the HCX Enterprise Site in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List HCX Enterprise Sites in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + HcxEnterpriseSiteList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = HcxEnterpriseSiteList.DeserializeHcxEnterpriseSiteList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List HCX Enterprise Sites in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + HcxEnterpriseSiteList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = HcxEnterpriseSiteList.DeserializeHcxEnterpriseSiteList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs new file mode 100644 index 000000000000..c82cd84bc80a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class LocationsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of LocationsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public LocationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateCheckTrialAvailabilityRequest(string location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.AVS/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/checkTrialAvailability", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Return trial status for subscription by region. + /// Azure region. + /// The cancellation token to use. + /// is null. + public async Task> CheckTrialAvailabilityAsync(string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var message = CreateCheckTrialAvailabilityRequest(location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Trial value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Trial.DeserializeTrial(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Return trial status for subscription by region. + /// Azure region. + /// The cancellation token to use. + /// is null. + public Response CheckTrialAvailability(string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var message = CreateCheckTrialAvailabilityRequest(location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Trial value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Trial.DeserializeTrial(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCheckQuotaAvailabilityRequest(string location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.AVS/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/checkQuotaAvailability", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Return quota for subscription by region. + /// Azure region. + /// The cancellation token to use. + /// is null. + public async Task> CheckQuotaAvailabilityAsync(string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var message = CreateCheckQuotaAvailabilityRequest(location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Quota value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Quota.DeserializeQuota(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Return quota for subscription by region. + /// Azure region. + /// The cancellation token to use. + /// is null. + public Response CheckQuotaAvailability(string location, CancellationToken cancellationToken = default) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + using var message = CreateCheckQuotaAvailabilityRequest(location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Quota value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Quota.DeserializeQuota(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs new file mode 100644 index 000000000000..17be6c18b66d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs @@ -0,0 +1,684 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class PlacementPoliciesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of PlacementPoliciesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public PlacementPoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/placementPolicies", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List placement policies in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PlacementPoliciesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PlacementPoliciesList.DeserializePlacementPoliciesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List placement policies in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PlacementPoliciesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PlacementPoliciesList.DeserializePlacementPoliciesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/placementPolicies/", false); + uri.AppendPath(placementPolicyName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a placement policy by name in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PlacementPolicyData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PlacementPolicyData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a placement policy by name in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// The cancellation token to use. + /// , , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PlacementPolicyData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PlacementPolicyData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyData placementPolicy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/placementPolicies/", false); + uri.AppendPath(placementPolicyName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(placementPolicy); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a placement policy in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// A placement policy in the private cloud cluster. + /// The cancellation token to use. + /// , , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyData placementPolicy, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + if (placementPolicy == null) + { + throw new ArgumentNullException(nameof(placementPolicy)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicy); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a placement policy in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// A placement policy in the private cloud cluster. + /// The cancellation token to use. + /// , , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyData placementPolicy, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + if (placementPolicy == null) + { + throw new ArgumentNullException(nameof(placementPolicy)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicy); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyUpdate placementPolicyUpdate) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/placementPolicies/", false); + uri.AppendPath(placementPolicyName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(placementPolicyUpdate); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Update a placement policy in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// The placement policy properties that may be updated. + /// The cancellation token to use. + /// , , , , or is null. + public async Task UpdateAsync(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyUpdate placementPolicyUpdate, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + if (placementPolicyUpdate == null) + { + throw new ArgumentNullException(nameof(placementPolicyUpdate)); + } + + using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicyUpdate); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update a placement policy in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// The placement policy properties that may be updated. + /// The cancellation token to use. + /// , , , , or is null. + public Response Update(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyUpdate placementPolicyUpdate, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + if (placementPolicyUpdate == null) + { + throw new ArgumentNullException(nameof(placementPolicyUpdate)); + } + + using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicyUpdate); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/placementPolicies/", false); + uri.AppendPath(placementPolicyName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a placement policy in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// The cancellation token to use. + /// , , , or is null. + public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a placement policy in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. + /// The cancellation token to use. + /// , , , or is null. + public Response Delete(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List placement policies in a private cloud cluster. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PlacementPoliciesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PlacementPoliciesList.DeserializePlacementPoliciesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List placement policies in a private cloud cluster. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PlacementPoliciesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PlacementPoliciesList.DeserializePlacementPoliciesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs new file mode 100644 index 000000000000..2ab4d7e1291b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs @@ -0,0 +1,908 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class PrivateCloudsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of PrivateCloudsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public PrivateCloudsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List private clouds in a resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// is null. + public async Task> GetAllAsync(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateGetAllRequest(resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateCloudList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PrivateCloudList.DeserializePrivateCloudList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List private clouds in a resource group. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// is null. + public Response GetAll(string resourceGroupName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateGetAllRequest(resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateCloudList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PrivateCloudList.DeserializePrivateCloudList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetInSubscriptionRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List private clouds in a subscription. + /// The cancellation token to use. + public async Task> GetInSubscriptionAsync(CancellationToken cancellationToken = default) + { + using var message = CreateGetInSubscriptionRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateCloudList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PrivateCloudList.DeserializePrivateCloudList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List private clouds in a subscription. + /// The cancellation token to use. + public Response GetInSubscription(CancellationToken cancellationToken = default) + { + using var message = CreateGetInSubscriptionRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateCloudList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PrivateCloudList.DeserializePrivateCloudList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateCloudData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PrivateCloudData.DeserializePrivateCloudData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PrivateCloudData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response Get(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateCloudData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PrivateCloudData.DeserializePrivateCloudData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((PrivateCloudData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, PrivateCloudData privateCloud) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(privateCloud); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, PrivateCloudData privateCloud, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (privateCloud == null) + { + throw new ArgumentNullException(nameof(privateCloud)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, privateCloud); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, PrivateCloudData privateCloud, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (privateCloud == null) + { + throw new ArgumentNullException(nameof(privateCloud)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, privateCloud); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string resourceGroupName, string privateCloudName, PrivateCloudUpdate privateCloudUpdate) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(privateCloudUpdate); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Update a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The private cloud properties to be updated. + /// The cancellation token to use. + /// , , or is null. + public async Task UpdateAsync(string resourceGroupName, string privateCloudName, PrivateCloudUpdate privateCloudUpdate, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (privateCloudUpdate == null) + { + throw new ArgumentNullException(nameof(privateCloudUpdate)); + } + + using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, privateCloudUpdate); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Update a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The private cloud properties to be updated. + /// The cancellation token to use. + /// , , or is null. + public Response Update(string resourceGroupName, string privateCloudName, PrivateCloudUpdate privateCloudUpdate, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (privateCloudUpdate == null) + { + throw new ArgumentNullException(nameof(privateCloudUpdate)); + } + + using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, privateCloudUpdate); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task DeleteAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response Delete(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRotateVcenterPasswordRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/rotateVcenterPassword", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Rotate the vCenter password. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task RotateVcenterPasswordAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateRotateVcenterPasswordRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Rotate the vCenter password. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response RotateVcenterPassword(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateRotateVcenterPasswordRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRotateNsxtPasswordRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/rotateNsxtPassword", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Rotate the NSX-T Manager password. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task RotateNsxtPasswordAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateRotateNsxtPasswordRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Rotate the NSX-T Manager password. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response RotateNsxtPassword(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateRotateNsxtPasswordRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAdminCredentialsRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/listAdminCredentials", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List the admin credentials for the private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetAdminCredentialsAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAdminCredentialsRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AdminCredentials value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AdminCredentials.DeserializeAdminCredentials(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List the admin credentials for the private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetAdminCredentials(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAdminCredentialsRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AdminCredentials value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AdminCredentials.DeserializeAdminCredentials(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List private clouds in a resource group. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateCloudList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PrivateCloudList.DeserializePrivateCloudList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List private clouds in a resource group. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateCloudList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PrivateCloudList.DeserializePrivateCloudList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetInSubscriptionNextPageRequest(string nextLink) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List private clouds in a subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public async Task> GetInSubscriptionNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateGetInSubscriptionNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PrivateCloudList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = PrivateCloudList.DeserializePrivateCloudList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List private clouds in a subscription. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public Response GetInSubscriptionNextPage(string nextLink, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + + using var message = CreateGetInSubscriptionNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PrivateCloudList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = PrivateCloudList.DeserializePrivateCloudList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs new file mode 100644 index 000000000000..cf914d23ea9e --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class ScriptCmdletsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of ScriptCmdletsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public ScriptCmdletsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName, string scriptPackageName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/scriptPackages/", false); + uri.AppendPath(scriptPackageName, true); + uri.AppendPath("/scriptCmdlets", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, scriptPackageName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptCmdletsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScriptCmdletsList.DeserializeScriptCmdletsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, scriptPackageName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptCmdletsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScriptCmdletsList.DeserializeScriptCmdletsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/scriptPackages/", false); + uri.AppendPath(scriptPackageName, true); + uri.AppendPath("/scriptCmdlets/", false); + uri.AppendPath(scriptCmdletName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Return information about a script cmdlet resource in a specific package on a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the script package in the private cloud. + /// Name of the script cmdlet resource in the script package in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + if (scriptCmdletName == null) + { + throw new ArgumentNullException(nameof(scriptCmdletName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptPackageName, scriptCmdletName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptCmdlet value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScriptCmdlet.DeserializeScriptCmdlet(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Return information about a script cmdlet resource in a specific package on a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the script package in the private cloud. + /// Name of the script cmdlet resource in the script package in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + if (scriptCmdletName == null) + { + throw new ArgumentNullException(nameof(scriptCmdletName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptPackageName, scriptCmdletName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptCmdlet value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScriptCmdlet.DeserializeScriptCmdlet(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName, string scriptPackageName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, scriptPackageName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptCmdletsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScriptCmdletsList.DeserializeScriptCmdletsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, scriptPackageName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptCmdletsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScriptCmdletsList.DeserializeScriptCmdletsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs new file mode 100644 index 000000000000..3f82eae99f81 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs @@ -0,0 +1,628 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class ScriptExecutionsRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of ScriptExecutionsRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public ScriptExecutionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/scriptExecutions", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List script executions in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptExecutionsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScriptExecutionsList.DeserializeScriptExecutionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List script executions in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptExecutionsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScriptExecutionsList.DeserializeScriptExecutionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string scriptExecutionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/scriptExecutions/", false); + uri.AppendPath(scriptExecutionName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get an script execution by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptExecutionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptExecutionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ScriptExecutionData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get an script execution by name in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptExecutionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptExecutionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ScriptExecutionData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecutionData scriptExecution) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/scriptExecutions/", false); + uri.AppendPath(scriptExecutionName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(scriptExecution); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a script execution in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the user-invoked script execution resource. + /// A script running in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecutionData scriptExecution, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + if (scriptExecution == null) + { + throw new ArgumentNullException(nameof(scriptExecution)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, scriptExecutionName, scriptExecution); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a script execution in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// The name of the private cloud. + /// Name of the user-invoked script execution resource. + /// A script running in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecutionData scriptExecution, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + if (scriptExecution == null) + { + throw new ArgumentNullException(nameof(scriptExecution)); + } + + using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, scriptExecutionName, scriptExecution); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string scriptExecutionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/scriptExecutions/", false); + uri.AppendPath(scriptExecutionName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Cancel a ScriptExecution in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, scriptExecutionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Cancel a ScriptExecution in a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// , , or is null. + public Response Delete(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, scriptExecutionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetExecutionLogsRequest(string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/scriptExecutions/", false); + uri.AppendPath(scriptExecutionName, true); + uri.AppendPath("/getExecutionLogs", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (scriptOutputStreamType != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteStartArray(); + foreach (var item in scriptOutputStreamType) + { + content.JsonWriter.WriteStringValue(item.ToString()); + } + content.JsonWriter.WriteEndArray(); + request.Content = content; + } + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Return the logs for a script execution resource. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the user-invoked script execution resource. + /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetExecutionLogsAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var message = CreateGetExecutionLogsRequest(resourceGroupName, privateCloudName, scriptExecutionName, scriptOutputStreamType); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptExecutionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ScriptExecutionData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Return the logs for a script execution resource. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the user-invoked script execution resource. + /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. + /// The cancellation token to use. + /// , , or is null. + public Response GetExecutionLogs(string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var message = CreateGetExecutionLogsRequest(resourceGroupName, privateCloudName, scriptExecutionName, scriptOutputStreamType); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptExecutionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ScriptExecutionData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List script executions in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptExecutionsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScriptExecutionsList.DeserializeScriptExecutionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List script executions in a private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptExecutionsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScriptExecutionsList.DeserializeScriptExecutionsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs new file mode 100644 index 000000000000..13e1415d5364 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class ScriptPackagesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of ScriptPackagesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public ScriptPackagesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/scriptPackages", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List script packages available to run on the private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptPackagesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScriptPackagesList.DeserializeScriptPackagesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List script packages available to run on the private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptPackagesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScriptPackagesList.DeserializeScriptPackagesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string scriptPackageName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/scriptPackages/", false); + uri.AppendPath(scriptPackageName, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a script package available to run on a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptPackageName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptPackage value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScriptPackage.DeserializeScriptPackage(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a script package available to run on a private cloud. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptPackageName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptPackage value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScriptPackage.DeserializeScriptPackage(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List script packages available to run on the private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ScriptPackagesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScriptPackagesList.DeserializeScriptPackagesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List script packages available to run on the private cloud. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ScriptPackagesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScriptPackagesList.DeserializeScriptPackagesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs new file mode 100644 index 000000000000..63b9e4a1c254 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class VirtualMachinesRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of VirtualMachinesRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public VirtualMachinesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/virtualMachines", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of virtual machines in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + VirtualMachinesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = VirtualMachinesList.DeserializeVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of virtual machines in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetAll(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + VirtualMachinesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = VirtualMachinesList.DeserializeVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/virtualMachines/", false); + uri.AppendPath(virtualMachineId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a virtual machine by id in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, virtualMachineId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + VirtualMachine value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = VirtualMachine.DeserializeVirtualMachine(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a virtual machine by id in a private cloud cluster. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// , , , or is null. + public Response Get(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, virtualMachineId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + VirtualMachine value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = VirtualMachine.DeserializeVirtualMachine(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRestrictMovementRequest(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/clusters/", false); + uri.AppendPath(clusterName, true); + uri.AppendPath("/virtualMachines/", false); + uri.AppendPath(virtualMachineId, true); + uri.AppendPath("/restrictMovement", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(restrictMovement); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Enable or disable DRS-driven VM movement restriction. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Virtual Machine identifier. + /// Whether VM DRS-driven movement is restricted (Enabled) or not (Disabled). + /// The cancellation token to use. + /// , , , , or is null. + public async Task RestrictMovementAsync(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + if (restrictMovement == null) + { + throw new ArgumentNullException(nameof(restrictMovement)); + } + + using var message = CreateRestrictMovementRequest(resourceGroupName, privateCloudName, clusterName, virtualMachineId, restrictMovement); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Enable or disable DRS-driven VM movement restriction. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// Virtual Machine identifier. + /// Whether VM DRS-driven movement is restricted (Enabled) or not (Disabled). + /// The cancellation token to use. + /// , , , , or is null. + public Response RestrictMovement(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + if (restrictMovement == null) + { + throw new ArgumentNullException(nameof(restrictMovement)); + } + + using var message = CreateRestrictMovementRequest(resourceGroupName, privateCloudName, clusterName, virtualMachineId, restrictMovement); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName, string clusterName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of virtual machines in a private cloud cluster. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + VirtualMachinesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = VirtualMachinesList.DeserializeVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of virtual machines in a private cloud cluster. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Name of the cluster in the private cloud. + /// The cancellation token to use. + /// , , , or is null. + public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + VirtualMachinesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = VirtualMachinesList.DeserializeVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs new file mode 100644 index 000000000000..a09145a294e8 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs @@ -0,0 +1,4428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + internal partial class WorkloadNetworksRestOperations + { + private string subscriptionId; + private Uri endpoint; + private string apiVersion; + private ClientDiagnostics _clientDiagnostics; + private HttpPipeline _pipeline; + private readonly string _userAgent; + + /// Initializes a new instance of WorkloadNetworksRestOperations. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The client options used to construct the current client. + /// The ID of the target subscription. + /// server parameter. + /// Api Version. + /// or is null. + public WorkloadNetworksRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + { + this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); + this.endpoint = endpoint ?? new Uri("https://management.azure.com"); + this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); + _clientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); + } + + internal HttpMessage CreateGetSegmentsRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of segments in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetSegmentsAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetSegmentsRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of segments in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetSegments(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetSegmentsRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetSegmentRequest(string resourceGroupName, string privateCloudName, string segmentId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a segment by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetSegmentAsync(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + using var message = CreateGetSegmentRequest(resourceGroupName, privateCloudName, segmentId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadNetworkSegmentData)null, message.Response); + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a segment by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// , , or is null. + public Response GetSegment(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + using var message = CreateGetSegmentRequest(resourceGroupName, privateCloudName, segmentId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadNetworkSegmentData)null, message.Response); + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateSegmentsRequest(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkSegment); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create a segment by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// NSX Segment. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateSegmentsAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var message = CreateCreateSegmentsRequest(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create a segment by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// NSX Segment. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateSegments(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var message = CreateCreateSegmentsRequest(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateSegmentsRequest(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkSegment); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a segment by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// NSX Segment. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateSegmentsAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var message = CreateUpdateSegmentsRequest(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a segment by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// NSX Segment. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdateSegments(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var message = CreateUpdateSegmentsRequest(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteSegmentRequest(string resourceGroupName, string privateCloudName, string segmentId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/segments/", false); + uri.AppendPath(segmentId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a segment by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteSegmentAsync(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + using var message = CreateDeleteSegmentRequest(resourceGroupName, privateCloudName, segmentId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a segment by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteSegment(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + using var message = CreateDeleteSegmentRequest(resourceGroupName, privateCloudName, segmentId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDhcpRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List dhcp in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetDhcpAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDhcpRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcpList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List dhcp in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetDhcp(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDhcpRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcpList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDhcpRequest(string resourceGroupName, string privateCloudName, string dhcpId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get dhcp by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetDhcpAsync(string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + + using var message = CreateGetDhcpRequest(resourceGroupName, privateCloudName, dhcpId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcp value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get dhcp by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// , , or is null. + public Response GetDhcp(string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + + using var message = CreateGetDhcpRequest(resourceGroupName, privateCloudName, dhcpId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcp value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateDhcpRequest(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDhcp); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create dhcp by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// NSX DHCP. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateDhcpAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var message = CreateCreateDhcpRequest(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create dhcp by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// NSX DHCP. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateDhcp(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var message = CreateCreateDhcpRequest(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateDhcpRequest(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDhcp); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update dhcp by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// NSX DHCP. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateDhcpAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var message = CreateUpdateDhcpRequest(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update dhcp by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// NSX DHCP. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdateDhcp(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var message = CreateUpdateDhcpRequest(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteDhcpRequest(string resourceGroupName, string privateCloudName, string dhcpId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dhcpConfigurations/", false); + uri.AppendPath(dhcpId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete dhcp by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteDhcpAsync(string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + + using var message = CreateDeleteDhcpRequest(resourceGroupName, privateCloudName, dhcpId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete dhcp by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteDhcp(string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + + using var message = CreateDeleteDhcpRequest(resourceGroupName, privateCloudName, dhcpId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetGatewaysRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/gateways", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of gateways in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetGatewaysAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetGatewaysRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGatewayList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of gateways in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetGateways(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetGatewaysRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGatewayList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetGatewayRequest(string resourceGroupName, string privateCloudName, string gatewayId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/gateways/", false); + uri.AppendPath(gatewayId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a gateway by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Gateway identifier. Generally the same as the Gateway's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetGatewayAsync(string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (gatewayId == null) + { + throw new ArgumentNullException(nameof(gatewayId)); + } + + using var message = CreateGetGatewayRequest(resourceGroupName, privateCloudName, gatewayId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGateway value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkGateway.DeserializeWorkloadNetworkGateway(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a gateway by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Gateway identifier. Generally the same as the Gateway's display name. + /// The cancellation token to use. + /// , , or is null. + public Response GetGateway(string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (gatewayId == null) + { + throw new ArgumentNullException(nameof(gatewayId)); + } + + using var message = CreateGetGatewayRequest(resourceGroupName, privateCloudName, gatewayId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGateway value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkGateway.DeserializeWorkloadNetworkGateway(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetPortMirroringRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of port mirroring profiles in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetPortMirroringAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetPortMirroringRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroringList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of port mirroring profiles in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetPortMirroring(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetPortMirroringRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroringList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetPortMirroringRequest(string resourceGroupName, string privateCloudName, string portMirroringId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a port mirroring profile by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetPortMirroringAsync(string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + + using var message = CreateGetPortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroring value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a port mirroring profile by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// , , or is null. + public Response GetPortMirroring(string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + + using var message = CreateGetPortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroring value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreatePortMirroringRequest(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkPortMirroring); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create a port mirroring profile by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// NSX port mirroring. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreatePortMirroringAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var message = CreateCreatePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create a port mirroring profile by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// NSX port mirroring. + /// The cancellation token to use. + /// , , , or is null. + public Response CreatePortMirroring(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var message = CreateCreatePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdatePortMirroringRequest(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkPortMirroring); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a port mirroring profile by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// NSX port mirroring. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdatePortMirroringAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var message = CreateUpdatePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a port mirroring profile by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// NSX port mirroring. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdatePortMirroring(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var message = CreateUpdatePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeletePortMirroringRequest(string resourceGroupName, string privateCloudName, string portMirroringId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/portMirroringProfiles/", false); + uri.AppendPath(portMirroringId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a port mirroring profile by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeletePortMirroringAsync(string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + + using var message = CreateDeletePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a port mirroring profile by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// , , or is null. + public Response DeletePortMirroring(string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + + using var message = CreateDeletePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetVMGroupsRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of vm groups in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetVMGroupsAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetVMGroupsRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVMGroupsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVMGroupsList.DeserializeWorkloadNetworkVMGroupsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of vm groups in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetVMGroups(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetVMGroupsRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVMGroupsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkVMGroupsList.DeserializeWorkloadNetworkVMGroupsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetVMGroupRequest(string resourceGroupName, string privateCloudName, string vmGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a vm group by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetVMGroupAsync(string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + + using var message = CreateGetVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVMGroup value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a vm group by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// , , or is null. + public Response GetVMGroup(string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + + using var message = CreateGetVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVMGroup value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateVMGroupRequest(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkVMGroup); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create a vm group by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// NSX VM Group. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateVMGroupAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var message = CreateCreateVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create a vm group by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// NSX VM Group. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateVMGroup(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var message = CreateCreateVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateVMGroupRequest(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkVMGroup); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a vm group by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// NSX VM Group. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateVMGroupAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var message = CreateUpdateVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a vm group by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// NSX VM Group. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdateVMGroup(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var message = CreateUpdateVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteVMGroupRequest(string resourceGroupName, string privateCloudName, string vmGroupId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/vmGroups/", false); + uri.AppendPath(vmGroupId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a vm group by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteVMGroupAsync(string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + + using var message = CreateDeleteVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a vm group by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteVMGroup(string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + + using var message = CreateDeleteVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetVirtualMachinesRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/virtualMachines", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of virtual machines in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetVirtualMachinesAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetVirtualMachinesRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachinesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of virtual machines in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetVirtualMachines(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetVirtualMachinesRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachinesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetVirtualMachineRequest(string resourceGroupName, string privateCloudName, string virtualMachineId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/virtualMachines/", false); + uri.AppendPath(virtualMachineId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a virtual machine by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetVirtualMachineAsync(string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var message = CreateGetVirtualMachineRequest(resourceGroupName, privateCloudName, virtualMachineId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachine value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVirtualMachine.DeserializeWorkloadNetworkVirtualMachine(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a virtual machine by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// , , or is null. + public Response GetVirtualMachine(string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var message = CreateGetVirtualMachineRequest(resourceGroupName, privateCloudName, virtualMachineId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachine value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkVirtualMachine.DeserializeWorkloadNetworkVirtualMachine(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDnsServicesRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of DNS services in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetDnsServicesAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDnsServicesRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsServicesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of DNS services in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetDnsServices(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDnsServicesRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsServicesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDnsServiceRequest(string resourceGroupName, string privateCloudName, string dnsServiceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a DNS service by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetDnsServiceAsync(string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + + using var message = CreateGetDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsService value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a DNS service by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// , , or is null. + public Response GetDnsService(string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + + using var message = CreateGetDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsService value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateDnsServiceRequest(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDnsService); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create a DNS service by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// NSX DNS Service. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateDnsServiceAsync(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var message = CreateCreateDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create a DNS service by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// NSX DNS Service. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateDnsService(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var message = CreateCreateDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateDnsServiceRequest(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDnsService); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a DNS service by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// NSX DNS Service. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateDnsServiceAsync(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var message = CreateUpdateDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a DNS service by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// NSX DNS Service. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdateDnsService(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var message = CreateUpdateDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteDnsServiceRequest(string resourceGroupName, string privateCloudName, string dnsServiceId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsServices/", false); + uri.AppendPath(dnsServiceId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a DNS service by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteDnsServiceAsync(string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + + using var message = CreateDeleteDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a DNS service by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteDnsService(string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + + using var message = CreateDeleteDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDnsZonesRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of DNS zones in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetDnsZonesAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDnsZonesRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZonesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of DNS zones in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetDnsZones(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDnsZonesRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZonesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDnsZoneRequest(string resourceGroupName, string privateCloudName, string dnsZoneId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a DNS zone by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetDnsZoneAsync(string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + + using var message = CreateGetDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZone value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a DNS zone by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// , , or is null. + public Response GetDnsZone(string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + + using var message = CreateGetDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZone value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateDnsZoneRequest(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDnsZone); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create a DNS zone by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// NSX DNS Zone. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreateDnsZoneAsync(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var message = CreateCreateDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create a DNS zone by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// NSX DNS Zone. + /// The cancellation token to use. + /// , , , or is null. + public Response CreateDnsZone(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var message = CreateCreateDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateDnsZoneRequest(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkDnsZone); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create or update a DNS zone by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// NSX DNS Zone. + /// The cancellation token to use. + /// , , , or is null. + public async Task UpdateDnsZoneAsync(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var message = CreateUpdateDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create or update a DNS zone by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// NSX DNS Zone. + /// The cancellation token to use. + /// , , , or is null. + public Response UpdateDnsZone(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var message = CreateUpdateDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteDnsZoneRequest(string resourceGroupName, string privateCloudName, string dnsZoneId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/dnsZones/", false); + uri.AppendPath(dnsZoneId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a DNS zone by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeleteDnsZoneAsync(string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + + using var message = CreateDeleteDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a DNS zone by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// , , or is null. + public Response DeleteDnsZone(string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + + using var message = CreateDeleteDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetPublicIPsRequest(string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs", false); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of Public IP Blocks in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public async Task> GetPublicIPsAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetPublicIPsRequest(resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIPsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of Public IP Blocks in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// or is null. + public Response GetPublicIPs(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetPublicIPsRequest(resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIPsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetPublicIPRequest(string resourceGroupName, string privateCloudName, string publicIPId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs/", false); + uri.AppendPath(publicIPId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Get a Public IP Block by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetPublicIPAsync(string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + + using var message = CreateGetPublicIPRequest(resourceGroupName, privateCloudName, publicIPId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIP value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Get a Public IP Block by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// , , or is null. + public Response GetPublicIP(string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + + using var message = CreateGetPublicIPRequest(resourceGroupName, privateCloudName, publicIPId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIP value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreatePublicIPRequest(string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs/", false); + uri.AppendPath(publicIPId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(workloadNetworkPublicIP); + request.Content = content; + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Create a Public IP Block by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// NSX Public IP Block. + /// The cancellation token to use. + /// , , , or is null. + public async Task CreatePublicIPAsync(string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + if (workloadNetworkPublicIP == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPublicIP)); + } + + using var message = CreateCreatePublicIPRequest(resourceGroupName, privateCloudName, publicIPId, workloadNetworkPublicIP); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Create a Public IP Block by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// NSX Public IP Block. + /// The cancellation token to use. + /// , , , or is null. + public Response CreatePublicIP(string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + if (workloadNetworkPublicIP == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPublicIP)); + } + + using var message = CreateCreatePublicIPRequest(resourceGroupName, privateCloudName, publicIPId, workloadNetworkPublicIP); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeletePublicIPRequest(string resourceGroupName, string privateCloudName, string publicIPId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AVS/privateClouds/", false); + uri.AppendPath(privateCloudName, true); + uri.AppendPath("/workloadNetworks/default/publicIPs/", false); + uri.AppendPath(publicIPId, true); + uri.AppendQuery("api-version", apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// Delete a Public IP Block by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// , , or is null. + public async Task DeletePublicIPAsync(string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + + using var message = CreateDeletePublicIPRequest(resourceGroupName, privateCloudName, publicIPId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// Delete a Public IP Block by id in a private cloud workload network. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// , , or is null. + public Response DeletePublicIP(string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) + { + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + + using var message = CreateDeletePublicIPRequest(resourceGroupName, privateCloudName, publicIPId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetSegmentsNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of segments in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetSegmentsNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetSegmentsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of segments in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetSegmentsNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetSegmentsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkSegmentsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkSegmentsList.DeserializeWorkloadNetworkSegmentsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDhcpNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List dhcp in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetDhcpNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDhcpNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcpList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List dhcp in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetDhcpNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDhcpNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDhcpList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkDhcpList.DeserializeWorkloadNetworkDhcpList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetGatewaysNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of gateways in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetGatewaysNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetGatewaysNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGatewayList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of gateways in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetGatewaysNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetGatewaysNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkGatewayList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkGatewayList.DeserializeWorkloadNetworkGatewayList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetPortMirroringNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of port mirroring profiles in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetPortMirroringNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetPortMirroringNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroringList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of port mirroring profiles in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetPortMirroringNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetPortMirroringNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPortMirroringList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkPortMirroringList.DeserializeWorkloadNetworkPortMirroringList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetVMGroupsNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of vm groups in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetVMGroupsNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetVMGroupsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVMGroupsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVMGroupsList.DeserializeWorkloadNetworkVMGroupsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of vm groups in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetVMGroupsNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetVMGroupsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVMGroupsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkVMGroupsList.DeserializeWorkloadNetworkVMGroupsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetVirtualMachinesNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of virtual machines in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetVirtualMachinesNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetVirtualMachinesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachinesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of virtual machines in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetVirtualMachinesNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetVirtualMachinesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkVirtualMachinesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkVirtualMachinesList.DeserializeWorkloadNetworkVirtualMachinesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDnsServicesNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of DNS services in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetDnsServicesNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDnsServicesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsServicesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of DNS services in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetDnsServicesNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDnsServicesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsServicesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkDnsServicesList.DeserializeWorkloadNetworkDnsServicesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetDnsZonesNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of DNS zones in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetDnsZonesNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDnsZonesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZonesList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of DNS zones in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetDnsZonesNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetDnsZonesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkDnsZonesList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkDnsZonesList.DeserializeWorkloadNetworkDnsZonesList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetPublicIPsNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.SetProperty("UserAgentOverride", _userAgent); + return message; + } + + /// List of Public IP Blocks in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public async Task> GetPublicIPsNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetPublicIPsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIPsList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); + } + } + + /// List of Public IP Blocks in a private cloud workload network. + /// The URL to the next page of results. + /// The name of the resource group. The name is case insensitive. + /// Name of the private cloud. + /// The cancellation token to use. + /// , , or is null. + public Response GetPublicIPsNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + { + if (nextLink == null) + { + throw new ArgumentNullException(nameof(nextLink)); + } + if (resourceGroupName == null) + { + throw new ArgumentNullException(nameof(resourceGroupName)); + } + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var message = CreateGetPublicIPsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadNetworkPublicIPsList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadNetworkPublicIPsList.DeserializeWorkloadNetworkPublicIPsList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw _clientDiagnostics.CreateRequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs new file mode 100644 index 000000000000..de224f6e12d1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a ScriptExecution along with the instance operations that can be performed on it. + public partial class ScriptExecution : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ScriptExecutionsRestOperations _restClient; + private readonly ScriptExecutionData _data; + + /// Initializes a new instance of the class for mocking. + protected ScriptExecution() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ScriptExecution(ArmResource options, ScriptExecutionData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ScriptExecution(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal ScriptExecution(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/scriptExecutions"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ScriptExecutionData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get an script execution by name in a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Get"); + scope.Start(); + try + { + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get an script execution by name in a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Get"); + scope.Start(); + try + { + var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Cancel a ScriptExecution in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ScriptExecutionDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Cancel a ScriptExecution in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual ScriptExecutionDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Delete"); + scope.Start(); + try + { + var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ScriptExecutionDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Return the logs for a script execution resource. + /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. + /// The cancellation token to use. + public virtual async Task> GetExecutionLogsAsync(IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.GetExecutionLogs"); + scope.Start(); + try + { + var response = await _restClient.GetExecutionLogsAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptOutputStreamType, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Return the logs for a script execution resource. + /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. + /// The cancellation token to use. + public virtual Response GetExecutionLogs(IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.GetExecutionLogs"); + scope.Start(); + try + { + var response = _restClient.GetExecutionLogs(Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptOutputStreamType, cancellationToken); + return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs new file mode 100644 index 000000000000..af9012a04ea3 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of ScriptExecution and their operations over a PrivateCloud. + public partial class ScriptExecutionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ScriptExecutionsRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected ScriptExecutionCollection() + { + } + + /// Initializes a new instance of ScriptExecutionCollection class. + /// The resource representing the parent resource. + internal ScriptExecutionCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; + + // Collection level operations. + + /// Create or update a script execution in a private cloud. + /// Name of the user-invoked script execution resource. + /// A script running in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual ScriptExecutionCreateOrUpdateOperation CreateOrUpdate(string scriptExecutionName, ScriptExecutionData scriptExecution, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + if (scriptExecution == null) + { + throw new ArgumentNullException(nameof(scriptExecution)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution, cancellationToken); + var operation = new ScriptExecutionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a script execution in a private cloud. + /// Name of the user-invoked script execution resource. + /// A script running in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string scriptExecutionName, ScriptExecutionData scriptExecution, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + if (scriptExecution == null) + { + throw new ArgumentNullException(nameof(scriptExecution)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution, cancellationToken).ConfigureAwait(false); + var operation = new ScriptExecutionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the user-invoked script execution resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string scriptExecutionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.Get"); + scope.Start(); + try + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ScriptExecution(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// Name of the user-invoked script execution resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string scriptExecutionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.Get"); + scope.Start(); + try + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ScriptExecution(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the user-invoked script execution resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string scriptExecutionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetIfExists"); + scope.Start(); + try + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + var response = _restClient.Get(Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the user-invoked script execution resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string scriptExecutionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetIfExists"); + scope.Start(); + try + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the user-invoked script execution resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string scriptExecutionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.CheckIfExists"); + scope.Start(); + try + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + var response = GetIfExists(scriptExecutionName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the user-invoked script execution resource. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string scriptExecutionName, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.CheckIfExists"); + scope.Start(); + try + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + var response = await GetIfExistsAsync(scriptExecutionName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List script executions in a private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List script executions in a private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs new file mode 100644 index 000000000000..9a7d60c8de68 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the ScriptExecution data model. + public partial class ScriptExecutionData : Resource + { + /// Initializes a new instance of ScriptExecutionData. + public ScriptExecutionData() + { + Parameters = new ChangeTrackingList(); + HiddenParameters = new ChangeTrackingList(); + Output = new ChangeTrackingList(); + NamedOutputs = new ChangeTrackingDictionary(); + Information = new ChangeTrackingList(); + Warnings = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); + } + + /// Initializes a new instance of ScriptExecutionData. + /// The id. + /// The name. + /// The type. + /// A reference to the script cmdlet resource if user is running a AVS script. + /// Parameters the script will accept. + /// Parameters that will be hidden/not visible to ARM, such as passwords and credentials. + /// Error message if the script was able to run, but if the script itself had errors or powershell threw an exception. + /// Time limit for execution. + /// Time to live for the resource. If not provided, will be available for 60 days. + /// Time the script execution was submitted. + /// Time the script execution was started. + /// Time the script execution was finished. + /// The state of the script execution resource. + /// Standard output stream from the powershell execution. + /// User-defined dictionary. + /// Standard information out stream from the powershell execution. + /// Standard warning out stream from the powershell execution. + /// Standard error output stream from the powershell execution. + internal ScriptExecutionData(ResourceIdentifier id, string name, ResourceType type, string scriptCmdletId, IList parameters, IList hiddenParameters, string failureReason, string timeout, string retention, DateTimeOffset? submittedAt, DateTimeOffset? startedAt, DateTimeOffset? finishedAt, ScriptExecutionProvisioningState? provisioningState, IList output, IDictionary namedOutputs, IReadOnlyList information, IReadOnlyList warnings, IReadOnlyList errors) : base(id, name, type) + { + ScriptCmdletId = scriptCmdletId; + Parameters = parameters; + HiddenParameters = hiddenParameters; + FailureReason = failureReason; + Timeout = timeout; + Retention = retention; + SubmittedAt = submittedAt; + StartedAt = startedAt; + FinishedAt = finishedAt; + ProvisioningState = provisioningState; + Output = output; + NamedOutputs = namedOutputs; + Information = information; + Warnings = warnings; + Errors = errors; + } + + /// A reference to the script cmdlet resource if user is running a AVS script. + public string ScriptCmdletId { get; set; } + /// Parameters the script will accept. + public IList Parameters { get; } + /// Parameters that will be hidden/not visible to ARM, such as passwords and credentials. + public IList HiddenParameters { get; } + /// Error message if the script was able to run, but if the script itself had errors or powershell threw an exception. + public string FailureReason { get; set; } + /// Time limit for execution. + public string Timeout { get; set; } + /// Time to live for the resource. If not provided, will be available for 60 days. + public string Retention { get; set; } + /// Time the script execution was submitted. + public DateTimeOffset? SubmittedAt { get; } + /// Time the script execution was started. + public DateTimeOffset? StartedAt { get; } + /// Time the script execution was finished. + public DateTimeOffset? FinishedAt { get; } + /// The state of the script execution resource. + public ScriptExecutionProvisioningState? ProvisioningState { get; } + /// Standard output stream from the powershell execution. + public IList Output { get; } + /// User-defined dictionary. + public IDictionary NamedOutputs { get; } + /// Standard information out stream from the powershell execution. + public IReadOnlyList Information { get; } + /// Standard warning out stream from the powershell execution. + public IReadOnlyList Warnings { get; } + /// Standard error output stream from the powershell execution. + public IReadOnlyList Errors { get; } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs new file mode 100644 index 000000000000..092411d3ab58 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs @@ -0,0 +1,2042 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a WorkloadNetworkSegment along with the instance operations that can be performed on it. + public partial class WorkloadNetworkSegment : ArmResource + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _restClient; + private readonly WorkloadNetworkSegmentData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkSegment() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadNetworkSegment(ArmResource options, WorkloadNetworkSegmentData resource) : base(options, resource.Id) + { + HasData = true; + _data = resource; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkSegment(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkSegment(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/default/segments"; + + /// Gets the valid resource type for the operations. + protected override ResourceType ValidResourceType => ResourceType; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadNetworkSegmentData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + /// Get a segment by id in a private cloud workload network. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Get"); + scope.Start(); + try + { + var response = await _restClient.GetSegmentAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a segment by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Get"); + scope.Start(); + try + { + var response = _restClient.GetSegment(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + + /// Delete dhcp by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Delete"); + scope.Start(); + try + { + var response = await _restClient.DeleteDhcpAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeleteDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDhcpRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete dhcp by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeleteDhcpOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Delete"); + scope.Start(); + try + { + var response = _restClient.DeleteDhcp(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeleteDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDhcpRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// Get dhcp by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetDhcpAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); + scope.Start(); + try + { + var response = await _restClient.GetDhcpAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get dhcp by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetDhcp(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); + scope.Start(); + try + { + var response = _restClient.GetDhcp(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a gateway by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetGatewayAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateway"); + scope.Start(); + try + { + var response = await _restClient.GetGatewayAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a gateway by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetGateway(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateway"); + scope.Start(); + try + { + var response = _restClient.GetGateway(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a port mirroring profile by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetPortMirroringAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); + scope.Start(); + try + { + var response = await _restClient.GetPortMirroringAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a port mirroring profile by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetPortMirroring(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); + scope.Start(); + try + { + var response = _restClient.GetPortMirroring(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a vm group by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetVMGroupAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroup"); + scope.Start(); + try + { + var response = await _restClient.GetVMGroupAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a vm group by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetVMGroup(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroup"); + scope.Start(); + try + { + var response = _restClient.GetVMGroup(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a virtual machine by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetVirtualMachineAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachine"); + scope.Start(); + try + { + var response = await _restClient.GetVirtualMachineAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a virtual machine by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetVirtualMachine(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachine"); + scope.Start(); + try + { + var response = _restClient.GetVirtualMachine(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS service by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetDnsServiceAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsService"); + scope.Start(); + try + { + var response = await _restClient.GetDnsServiceAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS service by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetDnsService(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsService"); + scope.Start(); + try + { + var response = _restClient.GetDnsService(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS zone by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetDnsZoneAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZone"); + scope.Start(); + try + { + var response = await _restClient.GetDnsZoneAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS zone by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetDnsZone(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZone"); + scope.Start(); + try + { + var response = _restClient.GetDnsZone(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a Public IP Block by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetPublicIPAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIP"); + scope.Start(); + try + { + var response = await _restClient.GetPublicIPAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a Public IP Block by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetPublicIP(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIP"); + scope.Start(); + try + { + var response = _restClient.GetPublicIP(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List dhcp in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDhcp(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); + scope.Start(); + try + { + var response = _restClient.GetDhcp(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); + scope.Start(); + try + { + var response = _restClient.GetDhcpNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List dhcp in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDhcpAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); + scope.Start(); + try + { + var response = await _restClient.GetDhcpAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); + scope.Start(); + try + { + var response = await _restClient.GetDhcpNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of gateways in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGateways(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateways"); + scope.Start(); + try + { + var response = _restClient.GetGateways(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateways"); + scope.Start(); + try + { + var response = _restClient.GetGatewaysNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of gateways in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGatewaysAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateways"); + scope.Start(); + try + { + var response = await _restClient.GetGatewaysAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateways"); + scope.Start(); + try + { + var response = await _restClient.GetGatewaysNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of port mirroring profiles in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPortMirroring(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); + scope.Start(); + try + { + var response = _restClient.GetPortMirroring(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); + scope.Start(); + try + { + var response = _restClient.GetPortMirroringNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of port mirroring profiles in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPortMirroringAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); + scope.Start(); + try + { + var response = await _restClient.GetPortMirroringAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); + scope.Start(); + try + { + var response = await _restClient.GetPortMirroringNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of vm groups in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVMGroups(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroups"); + scope.Start(); + try + { + var response = _restClient.GetVMGroups(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroups"); + scope.Start(); + try + { + var response = _restClient.GetVMGroupsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of vm groups in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVMGroupsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroups"); + scope.Start(); + try + { + var response = await _restClient.GetVMGroupsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroups"); + scope.Start(); + try + { + var response = await _restClient.GetVMGroupsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of virtual machines in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetVirtualMachines(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachines"); + scope.Start(); + try + { + var response = _restClient.GetVirtualMachines(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachines"); + scope.Start(); + try + { + var response = _restClient.GetVirtualMachinesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of virtual machines in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetVirtualMachinesAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachines"); + scope.Start(); + try + { + var response = await _restClient.GetVirtualMachinesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachines"); + scope.Start(); + try + { + var response = await _restClient.GetVirtualMachinesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of DNS services in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDnsServices(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsServices"); + scope.Start(); + try + { + var response = _restClient.GetDnsServices(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsServices"); + scope.Start(); + try + { + var response = _restClient.GetDnsServicesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of DNS services in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDnsServicesAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsServices"); + scope.Start(); + try + { + var response = await _restClient.GetDnsServicesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsServices"); + scope.Start(); + try + { + var response = await _restClient.GetDnsServicesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of DNS zones in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDnsZones(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZones"); + scope.Start(); + try + { + var response = _restClient.GetDnsZones(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZones"); + scope.Start(); + try + { + var response = _restClient.GetDnsZonesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of DNS zones in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDnsZonesAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZones"); + scope.Start(); + try + { + var response = await _restClient.GetDnsZonesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZones"); + scope.Start(); + try + { + var response = await _restClient.GetDnsZonesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of Public IP Blocks in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPublicIPs(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIPs"); + scope.Start(); + try + { + var response = _restClient.GetPublicIPs(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIPs"); + scope.Start(); + try + { + var response = _restClient.GetPublicIPsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of Public IP Blocks in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPublicIPsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIPs"); + scope.Start(); + try + { + var response = await _restClient.GetPublicIPsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIPs"); + scope.Start(); + try + { + var response = await _restClient.GetPublicIPsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// Create a segment by id in a private cloud workload network. + /// NSX Segment. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateSegmentsAsync(WorkloadNetworkSegmentData workloadNetworkSegment, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateSegments"); + scope.Start(); + try + { + var response = await _restClient.CreateSegmentsAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreateSegmentsOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateCreateSegmentsRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a segment by id in a private cloud workload network. + /// NSX Segment. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkCreateSegmentsOperation CreateSegments(WorkloadNetworkSegmentData workloadNetworkSegment, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateSegments"); + scope.Start(); + try + { + var response = _restClient.CreateSegments(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment, cancellationToken); + var operation = new WorkloadNetworkCreateSegmentsOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateCreateSegmentsRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a segment by id in a private cloud workload network. + /// NSX Segment. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateSegmentsAsync(WorkloadNetworkSegmentData workloadNetworkSegment, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateSegments"); + scope.Start(); + try + { + var response = await _restClient.UpdateSegmentsAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdateSegmentsOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateSegmentsRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a segment by id in a private cloud workload network. + /// NSX Segment. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdateSegmentsOperation UpdateSegments(WorkloadNetworkSegmentData workloadNetworkSegment, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateSegments"); + scope.Start(); + try + { + var response = _restClient.UpdateSegments(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment, cancellationToken); + var operation = new WorkloadNetworkUpdateSegmentsOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateSegmentsRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a segment by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteSegmentAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteSegment"); + scope.Start(); + try + { + var response = await _restClient.DeleteSegmentAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeleteSegmentOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteSegmentRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a segment by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeleteSegmentOperation DeleteSegment(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteSegment"); + scope.Start(); + try + { + var response = _restClient.DeleteSegment(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeleteSegmentOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteSegmentRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update dhcp by id in a private cloud workload network. + /// NSX DHCP. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateDhcpAsync(WorkloadNetworkDhcp workloadNetworkDhcp, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDhcp"); + scope.Start(); + try + { + var response = await _restClient.UpdateDhcpAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDhcp, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdateDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDhcpRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDhcp).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update dhcp by id in a private cloud workload network. + /// NSX DHCP. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdateDhcpOperation UpdateDhcp(WorkloadNetworkDhcp workloadNetworkDhcp, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDhcp"); + scope.Start(); + try + { + var response = _restClient.UpdateDhcp(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDhcp, cancellationToken); + var operation = new WorkloadNetworkUpdateDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDhcpRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDhcp).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a port mirroring profile by id in a private cloud workload network. + /// NSX port mirroring. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreatePortMirroringAsync(WorkloadNetworkPortMirroring workloadNetworkPortMirroring, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreatePortMirroring"); + scope.Start(); + try + { + var response = await _restClient.CreatePortMirroringAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreatePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreatePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a port mirroring profile by id in a private cloud workload network. + /// NSX port mirroring. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkCreatePortMirroringOperation CreatePortMirroring(WorkloadNetworkPortMirroring workloadNetworkPortMirroring, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreatePortMirroring"); + scope.Start(); + try + { + var response = _restClient.CreatePortMirroring(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring, cancellationToken); + var operation = new WorkloadNetworkCreatePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreatePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a port mirroring profile by id in a private cloud workload network. + /// NSX port mirroring. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdatePortMirroringAsync(WorkloadNetworkPortMirroring workloadNetworkPortMirroring, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdatePortMirroring"); + scope.Start(); + try + { + var response = await _restClient.UpdatePortMirroringAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdatePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdatePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a port mirroring profile by id in a private cloud workload network. + /// NSX port mirroring. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdatePortMirroringOperation UpdatePortMirroring(WorkloadNetworkPortMirroring workloadNetworkPortMirroring, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdatePortMirroring"); + scope.Start(); + try + { + var response = _restClient.UpdatePortMirroring(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring, cancellationToken); + var operation = new WorkloadNetworkUpdatePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdatePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a port mirroring profile by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeletePortMirroringAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeletePortMirroring"); + scope.Start(); + try + { + var response = await _restClient.DeletePortMirroringAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeletePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeletePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a port mirroring profile by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeletePortMirroringOperation DeletePortMirroring(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeletePortMirroring"); + scope.Start(); + try + { + var response = _restClient.DeletePortMirroring(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeletePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeletePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a vm group by id in a private cloud workload network. + /// NSX VM Group. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateVMGroupAsync(WorkloadNetworkVMGroup workloadNetworkVMGroup, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateVMGroup"); + scope.Start(); + try + { + var response = await _restClient.CreateVMGroupAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreateVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a vm group by id in a private cloud workload network. + /// NSX VM Group. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkCreateVMGroupOperation CreateVMGroup(WorkloadNetworkVMGroup workloadNetworkVMGroup, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateVMGroup"); + scope.Start(); + try + { + var response = _restClient.CreateVMGroup(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup, cancellationToken); + var operation = new WorkloadNetworkCreateVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a vm group by id in a private cloud workload network. + /// NSX VM Group. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateVMGroupAsync(WorkloadNetworkVMGroup workloadNetworkVMGroup, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateVMGroup"); + scope.Start(); + try + { + var response = await _restClient.UpdateVMGroupAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdateVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a vm group by id in a private cloud workload network. + /// NSX VM Group. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdateVMGroupOperation UpdateVMGroup(WorkloadNetworkVMGroup workloadNetworkVMGroup, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateVMGroup"); + scope.Start(); + try + { + var response = _restClient.UpdateVMGroup(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup, cancellationToken); + var operation = new WorkloadNetworkUpdateVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a vm group by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteVMGroupAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteVMGroup"); + scope.Start(); + try + { + var response = await _restClient.DeleteVMGroupAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeleteVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a vm group by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeleteVMGroupOperation DeleteVMGroup(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteVMGroup"); + scope.Start(); + try + { + var response = _restClient.DeleteVMGroup(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeleteVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a DNS service by id in a private cloud workload network. + /// NSX DNS Service. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateDnsServiceAsync(WorkloadNetworkDnsService workloadNetworkDnsService, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateDnsService"); + scope.Start(); + try + { + var response = await _restClient.CreateDnsServiceAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreateDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a DNS service by id in a private cloud workload network. + /// NSX DNS Service. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkCreateDnsServiceOperation CreateDnsService(WorkloadNetworkDnsService workloadNetworkDnsService, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateDnsService"); + scope.Start(); + try + { + var response = _restClient.CreateDnsService(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService, cancellationToken); + var operation = new WorkloadNetworkCreateDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a DNS service by id in a private cloud workload network. + /// NSX DNS Service. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateDnsServiceAsync(WorkloadNetworkDnsService workloadNetworkDnsService, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDnsService"); + scope.Start(); + try + { + var response = await _restClient.UpdateDnsServiceAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdateDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a DNS service by id in a private cloud workload network. + /// NSX DNS Service. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdateDnsServiceOperation UpdateDnsService(WorkloadNetworkDnsService workloadNetworkDnsService, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDnsService"); + scope.Start(); + try + { + var response = _restClient.UpdateDnsService(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService, cancellationToken); + var operation = new WorkloadNetworkUpdateDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a DNS service by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteDnsServiceAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteDnsService"); + scope.Start(); + try + { + var response = await _restClient.DeleteDnsServiceAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeleteDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a DNS service by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeleteDnsServiceOperation DeleteDnsService(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteDnsService"); + scope.Start(); + try + { + var response = _restClient.DeleteDnsService(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeleteDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a DNS zone by id in a private cloud workload network. + /// NSX DNS Zone. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreateDnsZoneAsync(WorkloadNetworkDnsZone workloadNetworkDnsZone, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateDnsZone"); + scope.Start(); + try + { + var response = await _restClient.CreateDnsZoneAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreateDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a DNS zone by id in a private cloud workload network. + /// NSX DNS Zone. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkCreateDnsZoneOperation CreateDnsZone(WorkloadNetworkDnsZone workloadNetworkDnsZone, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateDnsZone"); + scope.Start(); + try + { + var response = _restClient.CreateDnsZone(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone, cancellationToken); + var operation = new WorkloadNetworkCreateDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a DNS zone by id in a private cloud workload network. + /// NSX DNS Zone. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateDnsZoneAsync(WorkloadNetworkDnsZone workloadNetworkDnsZone, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDnsZone"); + scope.Start(); + try + { + var response = await _restClient.UpdateDnsZoneAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdateDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a DNS zone by id in a private cloud workload network. + /// NSX DNS Zone. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdateDnsZoneOperation UpdateDnsZone(WorkloadNetworkDnsZone workloadNetworkDnsZone, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDnsZone"); + scope.Start(); + try + { + var response = _restClient.UpdateDnsZone(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone, cancellationToken); + var operation = new WorkloadNetworkUpdateDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a DNS zone by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteDnsZoneAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteDnsZone"); + scope.Start(); + try + { + var response = await _restClient.DeleteDnsZoneAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeleteDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a DNS zone by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeleteDnsZoneOperation DeleteDnsZone(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteDnsZone"); + scope.Start(); + try + { + var response = _restClient.DeleteDnsZone(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeleteDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a Public IP Block by id in a private cloud workload network. + /// NSX Public IP Block. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task CreatePublicIPAsync(WorkloadNetworkPublicIP workloadNetworkPublicIP, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkPublicIP == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPublicIP)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreatePublicIP"); + scope.Start(); + try + { + var response = await _restClient.CreatePublicIPAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPublicIP, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreatePublicIPOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreatePublicIPRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPublicIP).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a Public IP Block by id in a private cloud workload network. + /// NSX Public IP Block. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkCreatePublicIPOperation CreatePublicIP(WorkloadNetworkPublicIP workloadNetworkPublicIP, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (workloadNetworkPublicIP == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPublicIP)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreatePublicIP"); + scope.Start(); + try + { + var response = _restClient.CreatePublicIP(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPublicIP, cancellationToken); + var operation = new WorkloadNetworkCreatePublicIPOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreatePublicIPRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPublicIP).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a Public IP Block by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeletePublicIPAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeletePublicIP"); + scope.Start(); + try + { + var response = await _restClient.DeletePublicIPAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeletePublicIPOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeletePublicIPRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a Public IP Block by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeletePublicIPOperation DeletePublicIP(bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeletePublicIP"); + scope.Start(); + try + { + var response = _restClient.DeletePublicIP(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeletePublicIPOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeletePublicIPRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs new file mode 100644 index 000000000000..decfda669e4d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of WorkloadNetworkSegment and their operations over a PrivateCloud. + public partial class WorkloadNetworkSegmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _restClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkSegmentCollection() + { + } + + /// Initializes a new instance of WorkloadNetworkSegmentCollection class. + /// The resource representing the parent resource. + internal WorkloadNetworkSegmentCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _restClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + /// Gets the valid resource type for this object. + protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; + + // Collection level operations. + + /// Create dhcp by id in a private cloud workload network. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// NSX DHCP. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WorkloadNetworkCreateDhcpOperation CreateOrUpdate(string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _restClient.CreateDhcp(Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp, cancellationToken); + var operation = new WorkloadNetworkCreateDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDhcpRequest(Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create dhcp by id in a private cloud workload network. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// NSX DHCP. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, bool waitForCompletion = true, CancellationToken cancellationToken = default) + { + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _restClient.CreateDhcpAsync(Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreateDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDhcpRequest(Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response Get(string segmentId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Get"); + scope.Start(); + try + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + var response = _restClient.GetSegment(Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkSegment(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets details for this resource from the service. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetAsync(string segmentId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Get"); + scope.Start(); + try + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + var response = await _restClient.GetSegmentAsync(Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkSegment(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response GetIfExists(string segmentId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); + scope.Start(); + try + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + var response = _restClient.GetSegment(Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> GetIfExistsAsync(string segmentId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); + scope.Start(); + try + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + var response = await _restClient.GetSegmentAsync(Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + return response.Value == null + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// A token to allow the caller to cancel the call to the service. The default value is . + public virtual Response CheckIfExists(string segmentId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CheckIfExists"); + scope.Start(); + try + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + var response = GetIfExists(segmentId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// A token to allow the caller to cancel the call to the service. The default value is . + public async virtual Task> CheckIfExistsAsync(string segmentId, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CheckIfExists"); + scope.Start(); + try + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + var response = await GetIfExistsAsync(segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of segments in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetSegments(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); + scope.Start(); + try + { + var response = _restClient.GetSegmentsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of segments in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetSegmentsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); + scope.Start(); + try + { + var response = await _restClient.GetSegmentsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs new file mode 100644 index 000000000000..82d55488565b --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing the WorkloadNetworkSegment data model. + public partial class WorkloadNetworkSegmentData : Resource + { + /// Initializes a new instance of WorkloadNetworkSegmentData. + public WorkloadNetworkSegmentData() + { + PortVif = new ChangeTrackingList(); + } + + /// Initializes a new instance of WorkloadNetworkSegmentData. + /// The id. + /// The name. + /// The type. + /// Display name of the segment. + /// Gateway which to connect segment to. + /// Subnet which to connect segment to. + /// Port Vif which segment is associated with. + /// Segment status. + /// The provisioning state. + /// NSX revision number. + internal WorkloadNetworkSegmentData(ResourceIdentifier id, string name, ResourceType type, string displayName, string connectedGateway, WorkloadNetworkSegmentSubnet subnet, IReadOnlyList portVif, SegmentStatusEnum? status, WorkloadNetworkSegmentProvisioningState? provisioningState, long? revision) : base(id, name, type) + { + DisplayName = displayName; + ConnectedGateway = connectedGateway; + Subnet = subnet; + PortVif = portVif; + Status = status; + ProvisioningState = provisioningState; + Revision = revision; + } + + /// Display name of the segment. + public string DisplayName { get; set; } + /// Gateway which to connect segment to. + public string ConnectedGateway { get; set; } + /// Subnet which to connect segment to. + public WorkloadNetworkSegmentSubnet Subnet { get; set; } + /// Port Vif which segment is associated with. + public IReadOnlyList PortVif { get; } + /// Segment status. + public SegmentStatusEnum? Status { get; } + /// The provisioning state. + public WorkloadNetworkSegmentProvisioningState? ProvisioningState { get; } + /// NSX revision number. + public long? Revision { get; set; } + } +} From 8aaf19891b9557893783795a76c24687817049bd Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Wed, 17 Nov 2021 17:09:16 -0600 Subject: [PATCH 4/7] WorkloadNetworks: NonResource --- .../Azure.ResourceManager.Avs/src/autorest.md | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md b/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md index f720c8b6c597..6d4a7ce282df 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md +++ b/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md @@ -5,21 +5,35 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true +# public-clients: true +# low-level-client: true security: AADToken require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/c4d6f92d3fd35a69ebce68f4c73c35c4238c2ac5/specification/vmware/resource-manager/readme.md tag: package-2021-12-01 model-namespace: false operation-group-to-resource-type: Locations: Microsoft.AVS/locations - VirtualMachines: Microsoft.AVS/privateClouds/clusters/virtualMachines - ScriptPackages: Microsoft.AVS/privateClouds/scriptPackages ScriptCmdlets: Microsoft.AVS/privateClouds/scriptPackages/scriptCmdlets + ScriptPackages: Microsoft.AVS/privateClouds/scriptPackages + VirtualMachines: Microsoft.AVS/privateClouds/clusters/virtualMachines operation-group-to-parent: Locations: subscriptions WorkloadNetworks: Microsoft.AVS/privateClouds operation-group-to-resource: +# Addons: NonResource +# Authorizations: NonResource +# CloudLinks: NonResource +# Clusters: NonResource +# Datastores: NonResource +# GlobalReachConnections: NonResource +# HcxExterpriseSites: NonResource Locations: NonResource - VirtualMachines: NonResource - ScriptPackages: NonResource +# Operations: NonResource +# PlacementPolicies: NonResource +# PrivateClouds: NonResource ScriptCmdlets: NonResource + ScriptExecutions: NonResource + ScriptPackages: NonResource + VirtualMachines: NonResource + WorkloadNetworks: NonResource ``` From deb889a6423f7035a1fd1ed74df08f97674c1e9e Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Wed, 17 Nov 2021 17:09:46 -0600 Subject: [PATCH 5/7] generate, errors in PrivateCloud now --- .../Extensions/ArmClientExtensions.cs | 22 - .../ScriptExecutionCreateOrUpdateOperation.cs | 11 +- .../WorkloadNetworkCreateSegmentsOperation.cs | 11 +- .../WorkloadNetworkUpdateSegmentsOperation.cs | 11 +- ...on.cs => ScriptExecution.Serialization.cs} | 9 +- .../ScriptExecution.cs} | 15 +- .../ScriptExecutionsList.Serialization.cs | 7 +- .../Generated/Models/ScriptExecutionsList.cs | 7 +- ...> WorkloadNetworkSegment.Serialization.cs} | 9 +- .../WorkloadNetworkSegment.cs} | 15 +- ...rkloadNetworkSegmentsList.Serialization.cs | 7 +- .../Models/WorkloadNetworkSegmentsList.cs | 7 +- .../src/Generated/PrivateCloud.cs | 1178 +++++++++- .../ScriptExecutionsRestOperations.cs | 38 +- .../WorkloadNetworksRestOperations.cs | 28 +- .../src/Generated/ScriptExecution.cs | 224 -- .../Generated/ScriptExecutionCollection.cs | 361 --- .../src/Generated/WorkloadNetworkSegment.cs | 2042 ----------------- .../WorkloadNetworkSegmentCollection.cs | 361 --- 19 files changed, 1234 insertions(+), 3129 deletions(-) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{ScriptExecutionData.Serialization.cs => ScriptExecution.Serialization.cs} (94%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{ScriptExecutionData.cs => Models/ScriptExecution.cs} (85%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{WorkloadNetworkSegmentData.Serialization.cs => WorkloadNetworkSegment.Serialization.cs} (92%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{WorkloadNetworkSegmentData.cs => Models/WorkloadNetworkSegment.cs} (77%) delete mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs delete mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs delete mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs delete mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs index d760c98ec50a..b285d4e8ff2c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs @@ -78,17 +78,6 @@ public static GlobalReachConnection GetGlobalReachConnection(this ArmClient armC } #endregion - #region WorkloadNetworkSegment - /// Gets an object representing a WorkloadNetworkSegment along with the instance operations that can be performed on it but with no data. - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static WorkloadNetworkSegment GetWorkloadNetworkSegment(this ArmClient armClient, ResourceIdentifier id) - { - return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkSegment(clientOptions, credential, uri, pipeline, id)); - } - #endregion - #region CloudLink /// Gets an object representing a CloudLink along with the instance operations that can be performed on it but with no data. /// The instance the method will execute against. @@ -121,16 +110,5 @@ public static PlacementPolicy GetPlacementPolicy(this ArmClient armClient, Resou return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new PlacementPolicy(clientOptions, credential, uri, pipeline, id)); } #endregion - - #region ScriptExecution - /// Gets an object representing a ScriptExecution along with the instance operations that can be performed on it but with no data. - /// The instance the method will execute against. - /// The resource ID of the resource to get. - /// Returns a object. - public static ScriptExecution GetScriptExecution(this ArmClient armClient, ResourceIdentifier id) - { - return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new ScriptExecution(clientOptions, credential, uri, pipeline, id)); - } - #endregion } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs index f801b5990d0c..9e70c8b6d0b3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs @@ -12,8 +12,6 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.Avs; -using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -22,17 +20,14 @@ public partial class ScriptExecutionCreateOrUpdateOperation : Operation _operation; - private readonly ArmResource _operationBase; - /// Initializes a new instance of ScriptExecutionCreateOrUpdateOperation for mocking. protected ScriptExecutionCreateOrUpdateOperation() { } - internal ScriptExecutionCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal ScriptExecutionCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ScriptExecutionCreateOrUpdateOperation"); - _operationBase = operationsBase; } /// @@ -65,13 +60,13 @@ internal ScriptExecutionCreateOrUpdateOperation(ArmResource operationsBase, Clie ScriptExecution IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new ScriptExecution(_operationBase, ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement)); + return ScriptExecution.DeserializeScriptExecution(document.RootElement); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new ScriptExecution(_operationBase, ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement)); + return ScriptExecution.DeserializeScriptExecution(document.RootElement); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs index dab68e2e0f96..f006548209cd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs @@ -12,8 +12,6 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.Avs; -using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -22,17 +20,14 @@ public partial class WorkloadNetworkCreateSegmentsOperation : Operation _operation; - private readonly ArmResource _operationBase; - /// Initializes a new instance of WorkloadNetworkCreateSegmentsOperation for mocking. protected WorkloadNetworkCreateSegmentsOperation() { } - internal WorkloadNetworkCreateSegmentsOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkCreateSegmentsOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateSegmentsOperation"); - _operationBase = operationsBase; } /// @@ -65,13 +60,13 @@ internal WorkloadNetworkCreateSegmentsOperation(ArmResource operationsBase, Clie WorkloadNetworkSegment IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new WorkloadNetworkSegment(_operationBase, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement)); + return WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new WorkloadNetworkSegment(_operationBase, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement)); + return WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs index 594be85653d7..06fffa58a49d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs @@ -12,8 +12,6 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.Avs; -using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -22,17 +20,14 @@ public partial class WorkloadNetworkUpdateSegmentsOperation : Operation _operation; - private readonly ArmResource _operationBase; - /// Initializes a new instance of WorkloadNetworkUpdateSegmentsOperation for mocking. protected WorkloadNetworkUpdateSegmentsOperation() { } - internal WorkloadNetworkUpdateSegmentsOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkUpdateSegmentsOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateSegmentsOperation"); - _operationBase = operationsBase; } /// @@ -65,13 +60,13 @@ internal WorkloadNetworkUpdateSegmentsOperation(ArmResource operationsBase, Clie WorkloadNetworkSegment IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new WorkloadNetworkSegment(_operationBase, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement)); + return WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new WorkloadNetworkSegment(_operationBase, WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement)); + return WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.Serialization.cs similarity index 94% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.Serialization.cs index aa33e74c3599..2c9e7954cfdc 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.Serialization.cs @@ -10,11 +10,10 @@ using System.Text.Json; using Azure.Core; using Azure.ResourceManager; -using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - public partial class ScriptExecutionData : IUtf8JsonSerializable + public partial class ScriptExecution : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -86,7 +85,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement element) + internal static ScriptExecution DeserializeScriptExecution(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -301,7 +300,7 @@ internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement e continue; } } - return new ScriptExecutionData(id, name, type, scriptCmdletId.Value, Optional.ToList(parameters), Optional.ToList(hiddenParameters), failureReason.Value, timeout.Value, retention.Value, Optional.ToNullable(submittedAt), Optional.ToNullable(startedAt), Optional.ToNullable(finishedAt), Optional.ToNullable(provisioningState), Optional.ToList(output), Optional.ToDictionary(namedOutputs), Optional.ToList(information), Optional.ToList(warnings), Optional.ToList(errors)); + return new ScriptExecution(id, name, type, scriptCmdletId.Value, Optional.ToList(parameters), Optional.ToList(hiddenParameters), failureReason.Value, timeout.Value, retention.Value, Optional.ToNullable(submittedAt), Optional.ToNullable(startedAt), Optional.ToNullable(finishedAt), Optional.ToNullable(provisioningState), Optional.ToList(output), Optional.ToDictionary(namedOutputs), Optional.ToList(information), Optional.ToList(warnings), Optional.ToList(errors)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.cs similarity index 85% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.cs index 9a7d60c8de68..717b41236a2d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.cs @@ -9,16 +9,15 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager; -using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// A class representing the ScriptExecution data model. - public partial class ScriptExecutionData : Resource + /// An instance of a script executed by a user - custom or AVS. + public partial class ScriptExecution : Resource { - /// Initializes a new instance of ScriptExecutionData. - public ScriptExecutionData() + /// Initializes a new instance of ScriptExecution. + public ScriptExecution() { Parameters = new ChangeTrackingList(); HiddenParameters = new ChangeTrackingList(); @@ -29,7 +28,7 @@ public ScriptExecutionData() Errors = new ChangeTrackingList(); } - /// Initializes a new instance of ScriptExecutionData. + /// Initializes a new instance of ScriptExecution. /// The id. /// The name. /// The type. @@ -48,7 +47,7 @@ public ScriptExecutionData() /// Standard information out stream from the powershell execution. /// Standard warning out stream from the powershell execution. /// Standard error output stream from the powershell execution. - internal ScriptExecutionData(ResourceIdentifier id, string name, ResourceType type, string scriptCmdletId, IList parameters, IList hiddenParameters, string failureReason, string timeout, string retention, DateTimeOffset? submittedAt, DateTimeOffset? startedAt, DateTimeOffset? finishedAt, ScriptExecutionProvisioningState? provisioningState, IList output, IDictionary namedOutputs, IReadOnlyList information, IReadOnlyList warnings, IReadOnlyList errors) : base(id, name, type) + internal ScriptExecution(ResourceIdentifier id, string name, ResourceType type, string scriptCmdletId, IList parameters, IList hiddenParameters, string failureReason, string timeout, string retention, DateTimeOffset? submittedAt, DateTimeOffset? startedAt, DateTimeOffset? finishedAt, ScriptExecutionProvisioningState? provisioningState, IList output, IDictionary namedOutputs, IReadOnlyList information, IReadOnlyList warnings, IReadOnlyList errors) : base(id, name, type) { ScriptCmdletId = scriptCmdletId; Parameters = parameters; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs index 08c85b9bbca1..70d29c9a747e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,7 +15,7 @@ internal partial class ScriptExecutionsList { internal static ScriptExecutionsList DeserializeScriptExecutionsList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -27,10 +26,10 @@ internal static ScriptExecutionsList DeserializeScriptExecutionsList(JsonElement property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ScriptExecutionData.DeserializeScriptExecutionData(item)); + array.Add(ScriptExecution.DeserializeScriptExecution(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs index 4c81417d6982..0ee7fdf56b3f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -17,20 +16,20 @@ internal partial class ScriptExecutionsList /// Initializes a new instance of ScriptExecutionsList. internal ScriptExecutionsList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of ScriptExecutionsList. /// List of scripts. /// URL to get the next page if any. - internal ScriptExecutionsList(IReadOnlyList value, string nextLink) + internal ScriptExecutionsList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// List of scripts. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.Serialization.cs similarity index 92% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.Serialization.cs index ed9ec8a617f4..5def71aa5c03 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.Serialization.cs @@ -9,11 +9,10 @@ using System.Text.Json; using Azure.Core; using Azure.ResourceManager; -using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - public partial class WorkloadNetworkSegmentData : IUtf8JsonSerializable + public partial class WorkloadNetworkSegment : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -44,7 +43,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData(JsonElement element) + internal static WorkloadNetworkSegment DeserializeWorkloadNetworkSegment(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -151,7 +150,7 @@ internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData continue; } } - return new WorkloadNetworkSegmentData(id, name, type, displayName.Value, connectedGateway.Value, subnet.Value, Optional.ToList(portVif), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + return new WorkloadNetworkSegment(id, name, type, displayName.Value, connectedGateway.Value, subnet.Value, Optional.ToList(portVif), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.cs similarity index 77% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.cs index 82d55488565b..292ce6fb54c1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.cs @@ -8,21 +8,20 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager; -using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs +namespace Azure.ResourceManager.Avs.Models { - /// A class representing the WorkloadNetworkSegment data model. - public partial class WorkloadNetworkSegmentData : Resource + /// NSX Segment. + public partial class WorkloadNetworkSegment : Resource { - /// Initializes a new instance of WorkloadNetworkSegmentData. - public WorkloadNetworkSegmentData() + /// Initializes a new instance of WorkloadNetworkSegment. + public WorkloadNetworkSegment() { PortVif = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkSegmentData. + /// Initializes a new instance of WorkloadNetworkSegment. /// The id. /// The name. /// The type. @@ -33,7 +32,7 @@ public WorkloadNetworkSegmentData() /// Segment status. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkSegmentData(ResourceIdentifier id, string name, ResourceType type, string displayName, string connectedGateway, WorkloadNetworkSegmentSubnet subnet, IReadOnlyList portVif, SegmentStatusEnum? status, WorkloadNetworkSegmentProvisioningState? provisioningState, long? revision) : base(id, name, type) + internal WorkloadNetworkSegment(ResourceIdentifier id, string name, ResourceType type, string displayName, string connectedGateway, WorkloadNetworkSegmentSubnet subnet, IReadOnlyList portVif, SegmentStatusEnum? status, WorkloadNetworkSegmentProvisioningState? provisioningState, long? revision) : base(id, name, type) { DisplayName = displayName; ConnectedGateway = connectedGateway; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs index 53f1006361cf..dc19e0bb2492 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,7 +15,7 @@ internal partial class WorkloadNetworkSegmentsList { internal static WorkloadNetworkSegmentsList DeserializeWorkloadNetworkSegmentsList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -27,10 +26,10 @@ internal static WorkloadNetworkSegmentsList DeserializeWorkloadNetworkSegmentsLi property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(item)); + array.Add(WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs index e2ee4ad25dcf..91f4148c95ef 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -17,20 +16,20 @@ internal partial class WorkloadNetworkSegmentsList /// Initializes a new instance of WorkloadNetworkSegmentsList. internal WorkloadNetworkSegmentsList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of WorkloadNetworkSegmentsList. /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkSegmentsList(IReadOnlyList value, string nextLink) + internal WorkloadNetworkSegmentsList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs index d3c5fbcb75d9..49932c849a0d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs @@ -25,7 +25,9 @@ public partial class PrivateCloud : ArmResource private readonly ClientDiagnostics _clientDiagnostics; private readonly PrivateCloudsRestOperations _restClient; private readonly PrivateCloudData _data; + private WorkloadNetworksRestOperations _workloadNetworksRestClient { get; } private ScriptPackagesRestOperations _scriptPackagesRestClient { get; } + private ScriptExecutionsRestOperations _scriptExecutionsRestClient { get; } /// Initializes a new instance of the class for mocking. protected PrivateCloud() @@ -41,7 +43,9 @@ internal PrivateCloud(ArmResource options, PrivateCloudData resource) : base(opt _data = resource; _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _scriptExecutionsRestClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); } /// Initializes a new instance of the class. @@ -51,7 +55,9 @@ internal PrivateCloud(ArmResource options, ResourceIdentifier id) : base(options { _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _scriptExecutionsRestClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); } /// Initializes a new instance of the class. @@ -64,7 +70,9 @@ internal PrivateCloud(ArmClientOptions clientOptions, TokenCredential credential { _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _scriptExecutionsRestClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); } /// Gets the resource type for the operations. @@ -395,6 +403,1013 @@ public virtual Response GetAdminCredentials(CancellationToken } } + /// Get a segment by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetWorkloadNetworkSegmentAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegment"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetSegmentAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a segment by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetWorkloadNetworkSegment(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegment"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetSegment(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get dhcp by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetWorkloadNetworkDhcpAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDhcpAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get dhcp by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetWorkloadNetworkDhcp(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDhcp(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a gateway by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetWorkloadNetworkGatewayAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateway"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetGatewayAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a gateway by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetWorkloadNetworkGateway(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateway"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetGateway(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a port mirroring profile by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetWorkloadNetworkPortMirroringAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPortMirroringAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a port mirroring profile by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetWorkloadNetworkPortMirroring(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPortMirroring(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a vm group by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetWorkloadNetworkVMGroupAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroup"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVMGroupAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a vm group by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetWorkloadNetworkVMGroup(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroup"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVMGroup(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a virtual machine by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetWorkloadNetworkVirtualMachineAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachine"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVirtualMachineAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a virtual machine by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetWorkloadNetworkVirtualMachine(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachine"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVirtualMachine(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS service by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetWorkloadNetworkDnsServiceAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsService"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsServiceAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS service by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetWorkloadNetworkDnsService(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsService"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsService(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS zone by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetWorkloadNetworkDnsZoneAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZone"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsZoneAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS zone by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetWorkloadNetworkDnsZone(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZone"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsZone(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a Public IP Block by id in a private cloud workload network. + /// The cancellation token to use. + public virtual async Task> GetWorkloadNetworkPublicIPAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIP"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPublicIPAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a Public IP Block by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response GetWorkloadNetworkPublicIP(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIP"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPublicIP(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of segments in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkSegments(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegments"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetSegments(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegments"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetSegmentsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of segments in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkSegmentsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegments"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetSegmentsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegments"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetSegmentsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List dhcp in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkDhcp(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDhcp(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDhcpNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List dhcp in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkDhcpAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDhcpAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDhcpNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of gateways in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkGateways(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateways"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetGateways(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateways"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetGatewaysNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of gateways in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkGatewaysAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateways"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetGatewaysAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateways"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetGatewaysNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of port mirroring profiles in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkPortMirroring(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPortMirroring(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPortMirroringNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of port mirroring profiles in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkPortMirroringAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPortMirroringAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPortMirroringNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of vm groups in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkVMGroups(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroups"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVMGroups(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroups"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVMGroupsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of vm groups in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkVMGroupsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroups"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVMGroupsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroups"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVMGroupsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of virtual machines in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkVirtualMachines(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachines"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVirtualMachines(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachines"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVirtualMachinesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of virtual machines in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkVirtualMachinesAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachines"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVirtualMachinesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachines"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVirtualMachinesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of DNS services in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkDnsServices(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsServices"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsServices(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsServices"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsServicesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of DNS services in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkDnsServicesAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsServices"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsServicesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsServices"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsServicesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of DNS zones in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkDnsZones(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZones"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsZones(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZones"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsZonesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of DNS zones in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkDnsZonesAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZones"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsZonesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZones"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsZonesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of Public IP Blocks in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetWorkloadNetworkPublicIPs(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIPs"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPublicIPs(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIPs"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPublicIPsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of Public IP Blocks in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetWorkloadNetworkPublicIPsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIPs"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPublicIPsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIPs"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPublicIPsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } /// Get a script package available to run on a private cloud. /// The cancellation token to use. public virtual async Task> GetScriptPackageAsync(CancellationToken cancellationToken = default) @@ -506,6 +1521,155 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) } return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } + /// Get an script execution by name in a private cloud. + /// The cancellation token to use. + public virtual async Task> GetScriptExecutionAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecution"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get an script execution by name in a private cloud. + /// The cancellation token to use. + public virtual Response GetScriptExecution(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecution"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Return the logs for a script execution resource. + /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. + /// The cancellation token to use. + public virtual async Task> GetScriptExecutionExecutionLogsAsync(IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutionExecutionLogs"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.GetExecutionLogsAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptOutputStreamType, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Return the logs for a script execution resource. + /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. + /// The cancellation token to use. + public virtual Response GetScriptExecutionExecutionLogs(IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutionExecutionLogs"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.GetExecutionLogs(Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptOutputStreamType, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List script executions in a private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScriptExecutions(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutions"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutions"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List script executions in a private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScriptExecutionsAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutions"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutions"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } /// Update a private cloud. /// The private cloud properties to be updated. @@ -681,13 +1845,6 @@ public GlobalReachConnectionCollection GetGlobalReachConnections() return new GlobalReachConnectionCollection(this); } - /// Gets a list of WorkloadNetworkSegments in the PrivateCloud. - /// An object representing collection of WorkloadNetworkSegments and their operations over a PrivateCloud. - public WorkloadNetworkSegmentCollection GetWorkloadNetworkSegments() - { - return new WorkloadNetworkSegmentCollection(this); - } - /// Gets a list of CloudLinks in the PrivateCloud. /// An object representing collection of CloudLinks and their operations over a PrivateCloud. public CloudLinkCollection GetCloudLinks() @@ -701,12 +1858,5 @@ public AddonCollection GetAddons() { return new AddonCollection(this); } - - /// Gets a list of ScriptExecutions in the PrivateCloud. - /// An object representing collection of ScriptExecutions and their operations over a PrivateCloud. - public ScriptExecutionCollection GetScriptExecutions() - { - return new ScriptExecutionCollection(this); - } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs index 3f82eae99f81..6b29ff1d2814 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs @@ -158,7 +158,7 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl /// Name of the user-invoked script execution resource. /// The cancellation token to use. /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -179,13 +179,11 @@ public async Task> GetAsync(string resourceGroupNa { case 200: { - ScriptExecutionData value = default; + ScriptExecution value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); + value = ScriptExecution.DeserializeScriptExecution(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ScriptExecutionData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -197,7 +195,7 @@ public async Task> GetAsync(string resourceGroupNa /// Name of the user-invoked script execution resource. /// The cancellation token to use. /// , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) + public Response Get(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -218,19 +216,17 @@ public Response Get(string resourceGroupName, string privat { case 200: { - ScriptExecutionData value = default; + ScriptExecution value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); + value = ScriptExecution.DeserializeScriptExecution(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ScriptExecutionData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecutionData scriptExecution) + internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecution scriptExecution) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -263,7 +259,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin /// A script running in the private cloud. /// The cancellation token to use. /// , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecutionData scriptExecution, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecution scriptExecution, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -301,7 +297,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string /// A script running in the private cloud. /// The cancellation token to use. /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecutionData scriptExecution, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecution scriptExecution, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -464,7 +460,7 @@ internal HttpMessage CreateGetExecutionLogsRequest(string resourceGroupName, str /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. /// The cancellation token to use. /// , , or is null. - public async Task> GetExecutionLogsAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + public async Task> GetExecutionLogsAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -485,13 +481,11 @@ public async Task> GetExecutionLogsAsync(string re { case 200: { - ScriptExecutionData value = default; + ScriptExecution value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); + value = ScriptExecution.DeserializeScriptExecution(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ScriptExecutionData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -504,7 +498,7 @@ public async Task> GetExecutionLogsAsync(string re /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. /// The cancellation token to use. /// , , or is null. - public Response GetExecutionLogs(string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + public Response GetExecutionLogs(string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -525,13 +519,11 @@ public Response GetExecutionLogs(string resourceGroupName, { case 200: { - ScriptExecutionData value = default; + ScriptExecution value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); + value = ScriptExecution.DeserializeScriptExecution(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((ScriptExecutionData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs index a09145a294e8..62721d0173a7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs @@ -157,7 +157,7 @@ internal HttpMessage CreateGetSegmentRequest(string resourceGroupName, string pr /// NSX Segment identifier. Generally the same as the Segment's display name. /// The cancellation token to use. /// , , or is null. - public async Task> GetSegmentAsync(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + public async Task> GetSegmentAsync(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -178,13 +178,11 @@ public async Task> GetSegmentAsync(string r { case 200: { - WorkloadNetworkSegmentData value = default; + WorkloadNetworkSegment value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); + value = WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((WorkloadNetworkSegmentData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -196,7 +194,7 @@ public async Task> GetSegmentAsync(string r /// NSX Segment identifier. Generally the same as the Segment's display name. /// The cancellation token to use. /// , , or is null. - public Response GetSegment(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + public Response GetSegment(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -217,19 +215,17 @@ public Response GetSegment(string resourceGroupName, { case 200: { - WorkloadNetworkSegmentData value = default; + WorkloadNetworkSegment value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); + value = WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((WorkloadNetworkSegmentData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreateSegmentsRequest(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment) + internal HttpMessage CreateCreateSegmentsRequest(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -262,7 +258,7 @@ internal HttpMessage CreateCreateSegmentsRequest(string resourceGroupName, strin /// NSX Segment. /// The cancellation token to use. /// , , , or is null. - public async Task CreateSegmentsAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + public async Task CreateSegmentsAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -300,7 +296,7 @@ public async Task CreateSegmentsAsync(string resourceGroupName, string /// NSX Segment. /// The cancellation token to use. /// , , , or is null. - public Response CreateSegments(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + public Response CreateSegments(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -331,7 +327,7 @@ public Response CreateSegments(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateUpdateSegmentsRequest(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment) + internal HttpMessage CreateUpdateSegmentsRequest(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -364,7 +360,7 @@ internal HttpMessage CreateUpdateSegmentsRequest(string resourceGroupName, strin /// NSX Segment. /// The cancellation token to use. /// , , , or is null. - public async Task UpdateSegmentsAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + public async Task UpdateSegmentsAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { @@ -402,7 +398,7 @@ public async Task UpdateSegmentsAsync(string resourceGroupName, string /// NSX Segment. /// The cancellation token to use. /// , , , or is null. - public Response UpdateSegments(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + public Response UpdateSegments(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default) { if (resourceGroupName == null) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs deleted file mode 100644 index de224f6e12d1..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.Avs -{ - /// A Class representing a ScriptExecution along with the instance operations that can be performed on it. - public partial class ScriptExecution : ArmResource - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly ScriptExecutionsRestOperations _restClient; - private readonly ScriptExecutionData _data; - - /// Initializes a new instance of the class for mocking. - protected ScriptExecution() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal ScriptExecution(ArmResource options, ScriptExecutionData resource) : base(options, resource.Id) - { - HasData = true; - _data = resource; - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal ScriptExecution(ArmResource options, ResourceIdentifier id) : base(options, id) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - } - - /// Initializes a new instance of the class. - /// The client options to build client context. - /// The credential to build client context. - /// The uri to build client context. - /// The pipeline to build client context. - /// The identifier of the resource that is the target of operations. - internal ScriptExecution(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - } - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/scriptExecutions"; - - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual ScriptExecutionData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - /// Get an script execution by name in a private cloud. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Get"); - scope.Start(); - try - { - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get an script execution by name in a private cloud. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Get"); - scope.Start(); - try - { - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists all available geo-locations. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) - { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); - } - - /// Lists all available geo-locations. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) - { - return ListAvailableLocations(ResourceType, cancellationToken); - } - - /// Cancel a ScriptExecution in a private cloud. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Delete"); - scope.Start(); - try - { - var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ScriptExecutionDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Cancel a ScriptExecution in a private cloud. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual ScriptExecutionDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Delete"); - scope.Start(); - try - { - var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ScriptExecutionDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - /// Return the logs for a script execution resource. - /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. - /// The cancellation token to use. - public virtual async Task> GetExecutionLogsAsync(IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecution.GetExecutionLogs"); - scope.Start(); - try - { - var response = await _restClient.GetExecutionLogsAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptOutputStreamType, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Return the logs for a script execution resource. - /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. - /// The cancellation token to use. - public virtual Response GetExecutionLogs(IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecution.GetExecutionLogs"); - scope.Start(); - try - { - var response = _restClient.GetExecutionLogs(Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptOutputStreamType, cancellationToken); - return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs deleted file mode 100644 index af9012a04ea3..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.Avs -{ - /// A class representing collection of ScriptExecution and their operations over a PrivateCloud. - public partial class ScriptExecutionCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly ScriptExecutionsRestOperations _restClient; - - /// Initializes a new instance of the class for mocking. - protected ScriptExecutionCollection() - { - } - - /// Initializes a new instance of ScriptExecutionCollection class. - /// The resource representing the parent resource. - internal ScriptExecutionCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; - - // Collection level operations. - - /// Create or update a script execution in a private cloud. - /// Name of the user-invoked script execution resource. - /// A script running in the private cloud. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// or is null. - public virtual ScriptExecutionCreateOrUpdateOperation CreateOrUpdate(string scriptExecutionName, ScriptExecutionData scriptExecution, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (scriptExecutionName == null) - { - throw new ArgumentNullException(nameof(scriptExecutionName)); - } - if (scriptExecution == null) - { - throw new ArgumentNullException(nameof(scriptExecution)); - } - - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution, cancellationToken); - var operation = new ScriptExecutionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a script execution in a private cloud. - /// Name of the user-invoked script execution resource. - /// A script running in the private cloud. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// or is null. - public async virtual Task CreateOrUpdateAsync(string scriptExecutionName, ScriptExecutionData scriptExecution, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (scriptExecutionName == null) - { - throw new ArgumentNullException(nameof(scriptExecutionName)); - } - if (scriptExecution == null) - { - throw new ArgumentNullException(nameof(scriptExecution)); - } - - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution, cancellationToken).ConfigureAwait(false); - var operation = new ScriptExecutionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets details for this resource from the service. - /// Name of the user-invoked script execution resource. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response Get(string scriptExecutionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.Get"); - scope.Start(); - try - { - if (scriptExecutionName == null) - { - throw new ArgumentNullException(nameof(scriptExecutionName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ScriptExecution(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets details for this resource from the service. - /// Name of the user-invoked script execution resource. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> GetAsync(string scriptExecutionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.Get"); - scope.Start(); - try - { - if (scriptExecutionName == null) - { - throw new ArgumentNullException(nameof(scriptExecutionName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new ScriptExecution(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// Name of the user-invoked script execution resource. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response GetIfExists(string scriptExecutionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetIfExists"); - scope.Start(); - try - { - if (scriptExecutionName == null) - { - throw new ArgumentNullException(nameof(scriptExecutionName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// Name of the user-invoked script execution resource. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> GetIfExistsAsync(string scriptExecutionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetIfExists"); - scope.Start(); - try - { - if (scriptExecutionName == null) - { - throw new ArgumentNullException(nameof(scriptExecutionName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// Name of the user-invoked script execution resource. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string scriptExecutionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.CheckIfExists"); - scope.Start(); - try - { - if (scriptExecutionName == null) - { - throw new ArgumentNullException(nameof(scriptExecutionName)); - } - - var response = GetIfExists(scriptExecutionName, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// Name of the user-invoked script execution resource. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string scriptExecutionName, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.CheckIfExists"); - scope.Start(); - try - { - if (scriptExecutionName == null) - { - throw new ArgumentNullException(nameof(scriptExecutionName)); - } - - var response = await GetIfExistsAsync(scriptExecutionName, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// List script executions in a private cloud. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); - scope.Start(); - try - { - var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); - scope.Start(); - try - { - var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List script executions in a private cloud. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); - scope.Start(); - try - { - var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); - scope.Start(); - try - { - var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - // Builders. - // public ArmBuilder Construct() { } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs deleted file mode 100644 index 092411d3ab58..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs +++ /dev/null @@ -1,2042 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.Avs -{ - /// A Class representing a WorkloadNetworkSegment along with the instance operations that can be performed on it. - public partial class WorkloadNetworkSegment : ArmResource - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WorkloadNetworksRestOperations _restClient; - private readonly WorkloadNetworkSegmentData _data; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkSegment() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal WorkloadNetworkSegment(ArmResource options, WorkloadNetworkSegmentData resource) : base(options, resource.Id) - { - HasData = true; - _data = resource; - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal WorkloadNetworkSegment(ArmResource options, ResourceIdentifier id) : base(options, id) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - } - - /// Initializes a new instance of the class. - /// The client options to build client context. - /// The credential to build client context. - /// The uri to build client context. - /// The pipeline to build client context. - /// The identifier of the resource that is the target of operations. - internal WorkloadNetworkSegment(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - } - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/default/segments"; - - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - - /// Gets whether or not the current instance has data. - public virtual bool HasData { get; } - - /// Gets the data representing this Feature. - /// Throws if there is no data loaded in the current instance. - public virtual WorkloadNetworkSegmentData Data - { - get - { - if (!HasData) - throw new InvalidOperationException("The current instance does not have data, you must call Get first."); - return _data; - } - } - - /// Get a segment by id in a private cloud workload network. - /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Get"); - scope.Start(); - try - { - var response = await _restClient.GetSegmentAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a segment by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Get"); - scope.Start(); - try - { - var response = _restClient.GetSegment(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists all available geo-locations. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) - { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); - } - - /// Lists all available geo-locations. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) - { - return ListAvailableLocations(ResourceType, cancellationToken); - } - - /// Delete dhcp by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Delete"); - scope.Start(); - try - { - var response = await _restClient.DeleteDhcpAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkDeleteDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDhcpRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete dhcp by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual WorkloadNetworkDeleteDhcpOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Delete"); - scope.Start(); - try - { - var response = _restClient.DeleteDhcp(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new WorkloadNetworkDeleteDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDhcpRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - /// Get dhcp by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetDhcpAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); - scope.Start(); - try - { - var response = await _restClient.GetDhcpAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get dhcp by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetDhcp(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); - scope.Start(); - try - { - var response = _restClient.GetDhcp(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a gateway by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetGatewayAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateway"); - scope.Start(); - try - { - var response = await _restClient.GetGatewayAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a gateway by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetGateway(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateway"); - scope.Start(); - try - { - var response = _restClient.GetGateway(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a port mirroring profile by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetPortMirroringAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); - scope.Start(); - try - { - var response = await _restClient.GetPortMirroringAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a port mirroring profile by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetPortMirroring(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); - scope.Start(); - try - { - var response = _restClient.GetPortMirroring(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a vm group by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetVMGroupAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroup"); - scope.Start(); - try - { - var response = await _restClient.GetVMGroupAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a vm group by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetVMGroup(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroup"); - scope.Start(); - try - { - var response = _restClient.GetVMGroup(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a virtual machine by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetVirtualMachineAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachine"); - scope.Start(); - try - { - var response = await _restClient.GetVirtualMachineAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a virtual machine by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetVirtualMachine(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachine"); - scope.Start(); - try - { - var response = _restClient.GetVirtualMachine(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a DNS service by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetDnsServiceAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsService"); - scope.Start(); - try - { - var response = await _restClient.GetDnsServiceAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a DNS service by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetDnsService(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsService"); - scope.Start(); - try - { - var response = _restClient.GetDnsService(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a DNS zone by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetDnsZoneAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZone"); - scope.Start(); - try - { - var response = await _restClient.GetDnsZoneAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a DNS zone by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetDnsZone(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZone"); - scope.Start(); - try - { - var response = _restClient.GetDnsZone(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a Public IP Block by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetPublicIPAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIP"); - scope.Start(); - try - { - var response = await _restClient.GetPublicIPAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a Public IP Block by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetPublicIP(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIP"); - scope.Start(); - try - { - var response = _restClient.GetPublicIP(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// List dhcp in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDhcp(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); - scope.Start(); - try - { - var response = _restClient.GetDhcp(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); - scope.Start(); - try - { - var response = _restClient.GetDhcpNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List dhcp in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDhcpAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); - scope.Start(); - try - { - var response = await _restClient.GetDhcpAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDhcp"); - scope.Start(); - try - { - var response = await _restClient.GetDhcpNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of gateways in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetGateways(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateways"); - scope.Start(); - try - { - var response = _restClient.GetGateways(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateways"); - scope.Start(); - try - { - var response = _restClient.GetGatewaysNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of gateways in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetGatewaysAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateways"); - scope.Start(); - try - { - var response = await _restClient.GetGatewaysAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetGateways"); - scope.Start(); - try - { - var response = await _restClient.GetGatewaysNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of port mirroring profiles in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPortMirroring(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); - scope.Start(); - try - { - var response = _restClient.GetPortMirroring(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); - scope.Start(); - try - { - var response = _restClient.GetPortMirroringNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of port mirroring profiles in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPortMirroringAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); - scope.Start(); - try - { - var response = await _restClient.GetPortMirroringAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPortMirroring"); - scope.Start(); - try - { - var response = await _restClient.GetPortMirroringNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of vm groups in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVMGroups(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroups"); - scope.Start(); - try - { - var response = _restClient.GetVMGroups(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroups"); - scope.Start(); - try - { - var response = _restClient.GetVMGroupsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of vm groups in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVMGroupsAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroups"); - scope.Start(); - try - { - var response = await _restClient.GetVMGroupsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVMGroups"); - scope.Start(); - try - { - var response = await _restClient.GetVMGroupsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of virtual machines in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachines(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachines"); - scope.Start(); - try - { - var response = _restClient.GetVirtualMachines(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachines"); - scope.Start(); - try - { - var response = _restClient.GetVirtualMachinesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of virtual machines in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachinesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachines"); - scope.Start(); - try - { - var response = await _restClient.GetVirtualMachinesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetVirtualMachines"); - scope.Start(); - try - { - var response = await _restClient.GetVirtualMachinesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of DNS services in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDnsServices(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsServices"); - scope.Start(); - try - { - var response = _restClient.GetDnsServices(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsServices"); - scope.Start(); - try - { - var response = _restClient.GetDnsServicesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of DNS services in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDnsServicesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsServices"); - scope.Start(); - try - { - var response = await _restClient.GetDnsServicesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsServices"); - scope.Start(); - try - { - var response = await _restClient.GetDnsServicesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of DNS zones in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetDnsZones(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZones"); - scope.Start(); - try - { - var response = _restClient.GetDnsZones(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZones"); - scope.Start(); - try - { - var response = _restClient.GetDnsZonesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of DNS zones in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetDnsZonesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZones"); - scope.Start(); - try - { - var response = await _restClient.GetDnsZonesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetDnsZones"); - scope.Start(); - try - { - var response = await _restClient.GetDnsZonesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of Public IP Blocks in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPublicIPs(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIPs"); - scope.Start(); - try - { - var response = _restClient.GetPublicIPs(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIPs"); - scope.Start(); - try - { - var response = _restClient.GetPublicIPsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of Public IP Blocks in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPublicIPsAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIPs"); - scope.Start(); - try - { - var response = await _restClient.GetPublicIPsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetPublicIPs"); - scope.Start(); - try - { - var response = await _restClient.GetPublicIPsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Create a segment by id in a private cloud workload network. - /// NSX Segment. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateSegmentsAsync(WorkloadNetworkSegmentData workloadNetworkSegment, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkSegment == null) - { - throw new ArgumentNullException(nameof(workloadNetworkSegment)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateSegments"); - scope.Start(); - try - { - var response = await _restClient.CreateSegmentsAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkCreateSegmentsOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateCreateSegmentsRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a segment by id in a private cloud workload network. - /// NSX Segment. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkCreateSegmentsOperation CreateSegments(WorkloadNetworkSegmentData workloadNetworkSegment, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkSegment == null) - { - throw new ArgumentNullException(nameof(workloadNetworkSegment)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateSegments"); - scope.Start(); - try - { - var response = _restClient.CreateSegments(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment, cancellationToken); - var operation = new WorkloadNetworkCreateSegmentsOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateCreateSegmentsRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a segment by id in a private cloud workload network. - /// NSX Segment. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task UpdateSegmentsAsync(WorkloadNetworkSegmentData workloadNetworkSegment, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkSegment == null) - { - throw new ArgumentNullException(nameof(workloadNetworkSegment)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateSegments"); - scope.Start(); - try - { - var response = await _restClient.UpdateSegmentsAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkUpdateSegmentsOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateSegmentsRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a segment by id in a private cloud workload network. - /// NSX Segment. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkUpdateSegmentsOperation UpdateSegments(WorkloadNetworkSegmentData workloadNetworkSegment, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkSegment == null) - { - throw new ArgumentNullException(nameof(workloadNetworkSegment)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateSegments"); - scope.Start(); - try - { - var response = _restClient.UpdateSegments(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment, cancellationToken); - var operation = new WorkloadNetworkUpdateSegmentsOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateSegmentsRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkSegment).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a segment by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task DeleteSegmentAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteSegment"); - scope.Start(); - try - { - var response = await _restClient.DeleteSegmentAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkDeleteSegmentOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteSegmentRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a segment by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual WorkloadNetworkDeleteSegmentOperation DeleteSegment(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteSegment"); - scope.Start(); - try - { - var response = _restClient.DeleteSegment(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new WorkloadNetworkDeleteSegmentOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteSegmentRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update dhcp by id in a private cloud workload network. - /// NSX DHCP. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task UpdateDhcpAsync(WorkloadNetworkDhcp workloadNetworkDhcp, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkDhcp == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDhcp)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDhcp"); - scope.Start(); - try - { - var response = await _restClient.UpdateDhcpAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDhcp, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkUpdateDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDhcpRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDhcp).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update dhcp by id in a private cloud workload network. - /// NSX DHCP. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkUpdateDhcpOperation UpdateDhcp(WorkloadNetworkDhcp workloadNetworkDhcp, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkDhcp == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDhcp)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDhcp"); - scope.Start(); - try - { - var response = _restClient.UpdateDhcp(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDhcp, cancellationToken); - var operation = new WorkloadNetworkUpdateDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDhcpRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDhcp).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a port mirroring profile by id in a private cloud workload network. - /// NSX port mirroring. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreatePortMirroringAsync(WorkloadNetworkPortMirroring workloadNetworkPortMirroring, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkPortMirroring == null) - { - throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreatePortMirroring"); - scope.Start(); - try - { - var response = await _restClient.CreatePortMirroringAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkCreatePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreatePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a port mirroring profile by id in a private cloud workload network. - /// NSX port mirroring. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkCreatePortMirroringOperation CreatePortMirroring(WorkloadNetworkPortMirroring workloadNetworkPortMirroring, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkPortMirroring == null) - { - throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreatePortMirroring"); - scope.Start(); - try - { - var response = _restClient.CreatePortMirroring(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring, cancellationToken); - var operation = new WorkloadNetworkCreatePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreatePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a port mirroring profile by id in a private cloud workload network. - /// NSX port mirroring. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task UpdatePortMirroringAsync(WorkloadNetworkPortMirroring workloadNetworkPortMirroring, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkPortMirroring == null) - { - throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdatePortMirroring"); - scope.Start(); - try - { - var response = await _restClient.UpdatePortMirroringAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkUpdatePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdatePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a port mirroring profile by id in a private cloud workload network. - /// NSX port mirroring. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkUpdatePortMirroringOperation UpdatePortMirroring(WorkloadNetworkPortMirroring workloadNetworkPortMirroring, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkPortMirroring == null) - { - throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdatePortMirroring"); - scope.Start(); - try - { - var response = _restClient.UpdatePortMirroring(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring, cancellationToken); - var operation = new WorkloadNetworkUpdatePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdatePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPortMirroring).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a port mirroring profile by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task DeletePortMirroringAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeletePortMirroring"); - scope.Start(); - try - { - var response = await _restClient.DeletePortMirroringAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkDeletePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeletePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a port mirroring profile by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual WorkloadNetworkDeletePortMirroringOperation DeletePortMirroring(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeletePortMirroring"); - scope.Start(); - try - { - var response = _restClient.DeletePortMirroring(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new WorkloadNetworkDeletePortMirroringOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeletePortMirroringRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a vm group by id in a private cloud workload network. - /// NSX VM Group. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateVMGroupAsync(WorkloadNetworkVMGroup workloadNetworkVMGroup, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkVMGroup == null) - { - throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateVMGroup"); - scope.Start(); - try - { - var response = await _restClient.CreateVMGroupAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkCreateVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a vm group by id in a private cloud workload network. - /// NSX VM Group. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkCreateVMGroupOperation CreateVMGroup(WorkloadNetworkVMGroup workloadNetworkVMGroup, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkVMGroup == null) - { - throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateVMGroup"); - scope.Start(); - try - { - var response = _restClient.CreateVMGroup(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup, cancellationToken); - var operation = new WorkloadNetworkCreateVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a vm group by id in a private cloud workload network. - /// NSX VM Group. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task UpdateVMGroupAsync(WorkloadNetworkVMGroup workloadNetworkVMGroup, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkVMGroup == null) - { - throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateVMGroup"); - scope.Start(); - try - { - var response = await _restClient.UpdateVMGroupAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkUpdateVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a vm group by id in a private cloud workload network. - /// NSX VM Group. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkUpdateVMGroupOperation UpdateVMGroup(WorkloadNetworkVMGroup workloadNetworkVMGroup, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkVMGroup == null) - { - throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateVMGroup"); - scope.Start(); - try - { - var response = _restClient.UpdateVMGroup(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup, cancellationToken); - var operation = new WorkloadNetworkUpdateVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkVMGroup).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a vm group by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task DeleteVMGroupAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteVMGroup"); - scope.Start(); - try - { - var response = await _restClient.DeleteVMGroupAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkDeleteVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a vm group by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual WorkloadNetworkDeleteVMGroupOperation DeleteVMGroup(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteVMGroup"); - scope.Start(); - try - { - var response = _restClient.DeleteVMGroup(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new WorkloadNetworkDeleteVMGroupOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteVMGroupRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a DNS service by id in a private cloud workload network. - /// NSX DNS Service. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateDnsServiceAsync(WorkloadNetworkDnsService workloadNetworkDnsService, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkDnsService == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDnsService)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateDnsService"); - scope.Start(); - try - { - var response = await _restClient.CreateDnsServiceAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkCreateDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a DNS service by id in a private cloud workload network. - /// NSX DNS Service. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkCreateDnsServiceOperation CreateDnsService(WorkloadNetworkDnsService workloadNetworkDnsService, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkDnsService == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDnsService)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateDnsService"); - scope.Start(); - try - { - var response = _restClient.CreateDnsService(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService, cancellationToken); - var operation = new WorkloadNetworkCreateDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a DNS service by id in a private cloud workload network. - /// NSX DNS Service. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task UpdateDnsServiceAsync(WorkloadNetworkDnsService workloadNetworkDnsService, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkDnsService == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDnsService)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDnsService"); - scope.Start(); - try - { - var response = await _restClient.UpdateDnsServiceAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkUpdateDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a DNS service by id in a private cloud workload network. - /// NSX DNS Service. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkUpdateDnsServiceOperation UpdateDnsService(WorkloadNetworkDnsService workloadNetworkDnsService, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkDnsService == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDnsService)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDnsService"); - scope.Start(); - try - { - var response = _restClient.UpdateDnsService(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService, cancellationToken); - var operation = new WorkloadNetworkUpdateDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsService).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a DNS service by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task DeleteDnsServiceAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteDnsService"); - scope.Start(); - try - { - var response = await _restClient.DeleteDnsServiceAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkDeleteDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a DNS service by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual WorkloadNetworkDeleteDnsServiceOperation DeleteDnsService(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteDnsService"); - scope.Start(); - try - { - var response = _restClient.DeleteDnsService(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new WorkloadNetworkDeleteDnsServiceOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDnsServiceRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a DNS zone by id in a private cloud workload network. - /// NSX DNS Zone. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreateDnsZoneAsync(WorkloadNetworkDnsZone workloadNetworkDnsZone, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkDnsZone == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateDnsZone"); - scope.Start(); - try - { - var response = await _restClient.CreateDnsZoneAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkCreateDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a DNS zone by id in a private cloud workload network. - /// NSX DNS Zone. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkCreateDnsZoneOperation CreateDnsZone(WorkloadNetworkDnsZone workloadNetworkDnsZone, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkDnsZone == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreateDnsZone"); - scope.Start(); - try - { - var response = _restClient.CreateDnsZone(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone, cancellationToken); - var operation = new WorkloadNetworkCreateDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a DNS zone by id in a private cloud workload network. - /// NSX DNS Zone. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task UpdateDnsZoneAsync(WorkloadNetworkDnsZone workloadNetworkDnsZone, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkDnsZone == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDnsZone"); - scope.Start(); - try - { - var response = await _restClient.UpdateDnsZoneAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkUpdateDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create or update a DNS zone by id in a private cloud workload network. - /// NSX DNS Zone. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkUpdateDnsZoneOperation UpdateDnsZone(WorkloadNetworkDnsZone workloadNetworkDnsZone, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkDnsZone == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.UpdateDnsZone"); - scope.Start(); - try - { - var response = _restClient.UpdateDnsZone(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone, cancellationToken); - var operation = new WorkloadNetworkUpdateDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateUpdateDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkDnsZone).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a DNS zone by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task DeleteDnsZoneAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteDnsZone"); - scope.Start(); - try - { - var response = await _restClient.DeleteDnsZoneAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkDeleteDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a DNS zone by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual WorkloadNetworkDeleteDnsZoneOperation DeleteDnsZone(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeleteDnsZone"); - scope.Start(); - try - { - var response = _restClient.DeleteDnsZone(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new WorkloadNetworkDeleteDnsZoneOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteDnsZoneRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a Public IP Block by id in a private cloud workload network. - /// NSX Public IP Block. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task CreatePublicIPAsync(WorkloadNetworkPublicIP workloadNetworkPublicIP, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkPublicIP == null) - { - throw new ArgumentNullException(nameof(workloadNetworkPublicIP)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreatePublicIP"); - scope.Start(); - try - { - var response = await _restClient.CreatePublicIPAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPublicIP, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkCreatePublicIPOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreatePublicIPRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPublicIP).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a Public IP Block by id in a private cloud workload network. - /// NSX Public IP Block. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual WorkloadNetworkCreatePublicIPOperation CreatePublicIP(WorkloadNetworkPublicIP workloadNetworkPublicIP, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (workloadNetworkPublicIP == null) - { - throw new ArgumentNullException(nameof(workloadNetworkPublicIP)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.CreatePublicIP"); - scope.Start(); - try - { - var response = _restClient.CreatePublicIP(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPublicIP, cancellationToken); - var operation = new WorkloadNetworkCreatePublicIPOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreatePublicIPRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, workloadNetworkPublicIP).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a Public IP Block by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task DeletePublicIPAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeletePublicIP"); - scope.Start(); - try - { - var response = await _restClient.DeletePublicIPAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkDeletePublicIPOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeletePublicIPRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Delete a Public IP Block by id in a private cloud workload network. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual WorkloadNetworkDeletePublicIPOperation DeletePublicIP(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.DeletePublicIP"); - scope.Start(); - try - { - var response = _restClient.DeletePublicIP(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new WorkloadNetworkDeletePublicIPOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeletePublicIPRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs deleted file mode 100644 index decfda669e4d..000000000000 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; -using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Core; - -namespace Azure.ResourceManager.Avs -{ - /// A class representing collection of WorkloadNetworkSegment and their operations over a PrivateCloud. - public partial class WorkloadNetworkSegmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _clientDiagnostics; - private readonly WorkloadNetworksRestOperations _restClient; - - /// Initializes a new instance of the class for mocking. - protected WorkloadNetworkSegmentCollection() - { - } - - /// Initializes a new instance of WorkloadNetworkSegmentCollection class. - /// The resource representing the parent resource. - internal WorkloadNetworkSegmentCollection(ArmResource parent) : base(parent) - { - _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; - - // Collection level operations. - - /// Create dhcp by id in a private cloud workload network. - /// NSX DHCP identifier. Generally the same as the DHCP display name. - /// NSX DHCP. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// or is null. - public virtual WorkloadNetworkCreateDhcpOperation CreateOrUpdate(string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (dhcpId == null) - { - throw new ArgumentNullException(nameof(dhcpId)); - } - if (workloadNetworkDhcp == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDhcp)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _restClient.CreateDhcp(Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp, cancellationToken); - var operation = new WorkloadNetworkCreateDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDhcpRequest(Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create dhcp by id in a private cloud workload network. - /// NSX DHCP identifier. Generally the same as the DHCP display name. - /// NSX DHCP. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// or is null. - public async virtual Task CreateOrUpdateAsync(string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (dhcpId == null) - { - throw new ArgumentNullException(nameof(dhcpId)); - } - if (workloadNetworkDhcp == null) - { - throw new ArgumentNullException(nameof(workloadNetworkDhcp)); - } - - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _restClient.CreateDhcpAsync(Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp, cancellationToken).ConfigureAwait(false); - var operation = new WorkloadNetworkCreateDhcpOperation(_clientDiagnostics, Pipeline, _restClient.CreateCreateDhcpRequest(Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets details for this resource from the service. - /// NSX Segment identifier. Generally the same as the Segment's display name. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response Get(string segmentId, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Get"); - scope.Start(); - try - { - if (segmentId == null) - { - throw new ArgumentNullException(nameof(segmentId)); - } - - var response = _restClient.GetSegment(Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken); - if (response.Value == null) - throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new WorkloadNetworkSegment(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Gets details for this resource from the service. - /// NSX Segment identifier. Generally the same as the Segment's display name. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> GetAsync(string segmentId, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Get"); - scope.Start(); - try - { - if (segmentId == null) - { - throw new ArgumentNullException(nameof(segmentId)); - } - - var response = await _restClient.GetSegmentAsync(Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new WorkloadNetworkSegment(Parent, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// NSX Segment identifier. Generally the same as the Segment's display name. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response GetIfExists(string segmentId, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); - scope.Start(); - try - { - if (segmentId == null) - { - throw new ArgumentNullException(nameof(segmentId)); - } - - var response = _restClient.GetSegment(Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// NSX Segment identifier. Generally the same as the Segment's display name. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> GetIfExistsAsync(string segmentId, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); - scope.Start(); - try - { - if (segmentId == null) - { - throw new ArgumentNullException(nameof(segmentId)); - } - - var response = await _restClient.GetSegmentAsync(Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// NSX Segment identifier. Generally the same as the Segment's display name. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string segmentId, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CheckIfExists"); - scope.Start(); - try - { - if (segmentId == null) - { - throw new ArgumentNullException(nameof(segmentId)); - } - - var response = GetIfExists(segmentId, cancellationToken: cancellationToken); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Tries to get details for this resource from the service. - /// NSX Segment identifier. Generally the same as the Segment's display name. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string segmentId, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CheckIfExists"); - scope.Start(); - try - { - if (segmentId == null) - { - throw new ArgumentNullException(nameof(segmentId)); - } - - var response = await GetIfExistsAsync(segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(response.Value != null, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// List of segments in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); - scope.Start(); - try - { - var response = _restClient.GetSegments(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); - scope.Start(); - try - { - var response = _restClient.GetSegmentsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of segments in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); - scope.Start(); - try - { - var response = await _restClient.GetSegmentsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); - scope.Start(); - try - { - var response = await _restClient.GetSegmentsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - // Builders. - // public ArmBuilder Construct() { } - } -} From a1dd4761476724dc522def75d3426a54eec23c86 Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Tue, 18 Jan 2022 12:11:13 -0500 Subject: [PATCH 6/7] gen autorest.csharp 3.0.0-beta.20220113.5 --- .../src/Generated/Addon.cs | 84 +- .../src/Generated/AddonCollection.cs | 178 +- .../src/Generated/AddonData.cs | 2 +- .../src/Generated/CloudLink.cs | 84 +- .../src/Generated/CloudLinkCollection.cs | 178 +- .../src/Generated/CloudLinkData.cs | 2 +- .../src/Generated/Cluster.cs | 231 +-- .../src/Generated/ClusterCollection.cs | 178 +- .../src/Generated/ClusterData.cs | 1 - .../src/Generated/Datastore.cs | 84 +- .../src/Generated/DatastoreCollection.cs | 178 +- .../src/Generated/DatastoreData.cs | 2 +- .../Generated/ExpressRouteAuthorization.cs | 84 +- .../ExpressRouteAuthorizationCollection.cs | 178 +- .../ExpressRouteAuthorizationData.cs | 2 +- .../Extensions/ArmClientExtensions.cs | 166 ++ .../Extensions/SubscriptionExtensions.cs | 279 ++- .../src/Generated/GlobalReachConnection.cs | 84 +- .../GlobalReachConnectionCollection.cs | 178 +- .../Generated/GlobalReachConnectionData.cs | 2 +- .../src/Generated/HcxEnterpriseSite.cs | 80 +- .../Generated/HcxEnterpriseSiteCollection.cs | 174 +- .../src/Generated/HcxEnterpriseSiteData.cs | 2 +- .../AddonCreateOrUpdateOperation.cs | 6 +- .../AuthorizationCreateOrUpdateOperation.cs | 6 +- .../CloudLinkCreateOrUpdateOperation.cs | 6 +- .../ClusterCreateOrUpdateOperation.cs | 6 +- .../ClusterUpdateOperation.cs | 6 +- .../DatastoreCreateOrUpdateOperation.cs | 6 +- ...lReachConnectionCreateOrUpdateOperation.cs | 6 +- .../PlacementPolicyCreateOrUpdateOperation.cs | 6 +- .../PlacementPolicyUpdateOperation.cs | 6 +- .../PrivateCloudCreateOrUpdateOperation.cs | 6 +- .../PrivateCloudUpdateOperation.cs | 6 +- .../ScriptExecutionCreateOrUpdateOperation.cs | 13 +- .../WorkloadNetworkCreateDhcpOperation.cs | 13 +- ...orkloadNetworkCreateDnsServiceOperation.cs | 13 +- .../WorkloadNetworkCreateDnsZoneOperation.cs | 13 +- ...loadNetworkCreatePortMirroringOperation.cs | 13 +- .../WorkloadNetworkCreatePublicIPOperation.cs | 13 +- .../WorkloadNetworkCreateSegmentsOperation.cs | 13 +- .../WorkloadNetworkCreateVMGroupOperation.cs | 13 +- .../WorkloadNetworkUpdateDhcpOperation.cs | 13 +- ...orkloadNetworkUpdateDnsServiceOperation.cs | 13 +- .../WorkloadNetworkUpdateDnsZoneOperation.cs | 13 +- ...loadNetworkUpdatePortMirroringOperation.cs | 13 +- .../WorkloadNetworkUpdateSegmentsOperation.cs | 13 +- .../WorkloadNetworkUpdateVMGroupOperation.cs | 13 +- .../Models/AddonData.Serialization.cs | 3 +- .../Models/CloudLinkData.Serialization.cs | 3 +- .../Models/ClusterData.Serialization.cs | 3 +- .../Models/DatastoreData.Serialization.cs | 3 +- ...essRouteAuthorizationData.Serialization.cs | 3 +- ...GlobalReachConnectionData.Serialization.cs | 3 +- .../HcxEnterpriseSiteData.Serialization.cs | 3 +- .../PlacementPolicyData.Serialization.cs | 3 +- .../Models/PrivateCloudData.Serialization.cs | 6 +- ...n.cs => ScriptCmdletData.Serialization.cs} | 12 +- .../Models/ScriptCmdletsList.Serialization.cs | 7 +- .../src/Generated/Models/ScriptCmdletsList.cs | 7 +- ...s => ScriptExecutionData.Serialization.cs} | 12 +- .../ScriptExecutionsList.Serialization.cs | 7 +- .../Generated/Models/ScriptExecutionsList.cs | 7 +- ....cs => ScriptPackageData.Serialization.cs} | 11 +- .../ScriptPackagesList.Serialization.cs | 7 +- .../Generated/Models/ScriptPackagesList.cs | 7 +- ...cs => VirtualMachineData.Serialization.cs} | 12 +- .../VirtualMachinesList.Serialization.cs | 7 +- .../Generated/Models/VirtualMachinesList.cs | 7 +- ... WorkloadNetworkDhcpData.Serialization.cs} | 12 +- .../WorkloadNetworkDhcpList.Serialization.cs | 7 +- .../Models/WorkloadNetworkDhcpList.cs | 7 +- ...oadNetworkDnsServiceData.Serialization.cs} | 12 +- ...oadNetworkDnsServicesList.Serialization.cs | 7 +- .../Models/WorkloadNetworkDnsServicesList.cs | 7 +- ...rkloadNetworkDnsZoneData.Serialization.cs} | 12 +- ...rkloadNetworkDnsZonesList.Serialization.cs | 7 +- .../Models/WorkloadNetworkDnsZonesList.cs | 7 +- ...rkloadNetworkGatewayData.Serialization.cs} | 11 +- ...orkloadNetworkGatewayList.Serialization.cs | 7 +- .../Models/WorkloadNetworkGatewayList.cs | 7 +- ...NetworkPortMirroringData.Serialization.cs} | 12 +- ...dNetworkPortMirroringList.Serialization.cs | 7 +- .../WorkloadNetworkPortMirroringList.cs | 7 +- ...kloadNetworkPublicIPData.Serialization.cs} | 12 +- ...kloadNetworkPublicIPsList.Serialization.cs | 7 +- .../Models/WorkloadNetworkPublicIPsList.cs | 7 +- ...rkloadNetworkSegmentData.Serialization.cs} | 12 +- ...rkloadNetworkSegmentsList.Serialization.cs | 7 +- .../Models/WorkloadNetworkSegmentsList.cs | 7 +- ...rkloadNetworkVMGroupData.Serialization.cs} | 12 +- ...rkloadNetworkVMGroupsList.Serialization.cs | 7 +- .../Models/WorkloadNetworkVMGroupsList.cs | 7 +- ...etworkVirtualMachineData.Serialization.cs} | 12 +- ...etworkVirtualMachinesList.Serialization.cs | 7 +- .../WorkloadNetworkVirtualMachinesList.cs | 7 +- .../src/Generated/PlacementPolicy.cs | 96 +- .../Generated/PlacementPolicyCollection.cs | 178 +- .../src/Generated/PlacementPolicyData.cs | 2 +- .../src/Generated/PrivateCloud.cs | 1633 +++-------------- .../src/Generated/PrivateCloudCollection.cs | 177 +- .../src/Generated/PrivateCloudData.cs | 6 +- .../RestOperations/AddonsRestOperations.cs | 127 +- .../AuthorizationsRestOperations.cs | 127 +- .../CloudLinksRestOperations.cs | 127 +- .../RestOperations/ClustersRestOperations.cs | 151 +- .../DatastoresRestOperations.cs | 127 +- .../GlobalReachConnectionsRestOperations.cs | 127 +- .../HcxEnterpriseSitesRestOperations.cs | 127 +- .../RestOperations/LocationsRestOperations.cs | 55 +- .../PlacementPoliciesRestOperations.cs | 151 +- .../PrivateCloudsRestOperations.cs | 271 ++- .../ScriptCmdletsRestOperations.cs | 91 +- .../ScriptExecutionsRestOperations.cs | 171 +- .../ScriptPackagesRestOperations.cs | 91 +- .../VirtualMachinesRestOperations.cs | 115 +- .../WorkloadNetworksRestOperations.cs | 1243 +++++++++---- .../src/Generated/ScriptCmdlet.cs | 180 ++ .../src/Generated/ScriptCmdletCollection.cs | 304 +++ .../ScriptCmdlet.cs => ScriptCmdletData.cs} | 16 +- .../src/Generated/ScriptExecution.cs | 263 +++ .../Generated/ScriptExecutionCollection.cs | 373 ++++ ...iptExecution.cs => ScriptExecutionData.cs} | 16 +- .../src/Generated/ScriptPackage.cs | 190 ++ .../src/Generated/ScriptPackageCollection.cs | 304 +++ .../ScriptPackage.cs => ScriptPackageData.cs} | 16 +- .../src/Generated/VirtualMachine.cs | 239 +++ .../src/Generated/VirtualMachineCollection.cs | 304 +++ ...irtualMachine.cs => VirtualMachineData.cs} | 17 +- .../src/Generated/WorkloadNetworkDhcp.cs | 283 +++ .../WorkloadNetworkDhcpCollection.cs | 373 ++++ ...workDhcp.cs => WorkloadNetworkDhcpData.cs} | 17 +- .../Generated/WorkloadNetworkDnsService.cs | 283 +++ .../WorkloadNetworkDnsServiceCollection.cs | 373 ++++ ...ce.cs => WorkloadNetworkDnsServiceData.cs} | 16 +- .../src/Generated/WorkloadNetworkDnsZone.cs | 283 +++ .../WorkloadNetworkDnsZoneCollection.cs | 373 ++++ ...sZone.cs => WorkloadNetworkDnsZoneData.cs} | 16 +- .../src/Generated/WorkloadNetworkGateway.cs | 180 ++ .../WorkloadNetworkGatewayCollection.cs | 304 +++ ...teway.cs => WorkloadNetworkGatewayData.cs} | 16 +- .../Generated/WorkloadNetworkPortMirroring.cs | 283 +++ .../WorkloadNetworkPortMirroringCollection.cs | 373 ++++ ...cs => WorkloadNetworkPortMirroringData.cs} | 17 +- .../src/Generated/WorkloadNetworkPublicIP.cs | 225 +++ .../WorkloadNetworkPublicIPCollection.cs | 373 ++++ ...icIP.cs => WorkloadNetworkPublicIPData.cs} | 17 +- .../src/Generated/WorkloadNetworkSegment.cs | 283 +++ .../WorkloadNetworkSegmentCollection.cs | 373 ++++ ...gment.cs => WorkloadNetworkSegmentData.cs} | 16 +- .../src/Generated/WorkloadNetworkVMGroup.cs | 283 +++ .../WorkloadNetworkVMGroupCollection.cs | 373 ++++ ...Group.cs => WorkloadNetworkVMGroupData.cs} | 16 +- .../WorkloadNetworkVirtualMachine.cs | 180 ++ ...WorkloadNetworkVirtualMachineCollection.cs | 304 +++ ...s => WorkloadNetworkVirtualMachineData.cs} | 17 +- 156 files changed, 12229 insertions(+), 3881 deletions(-) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{ScriptCmdlet.Serialization.cs => ScriptCmdletData.Serialization.cs} (87%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{ScriptExecution.Serialization.cs => ScriptExecutionData.Serialization.cs} (94%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{ScriptPackage.Serialization.cs => ScriptPackageData.Serialization.cs} (85%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{VirtualMachine.Serialization.cs => VirtualMachineData.Serialization.cs} (86%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{WorkloadNetworkDhcp.Serialization.cs => WorkloadNetworkDhcpData.Serialization.cs} (80%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{WorkloadNetworkDnsService.Serialization.cs => WorkloadNetworkDnsServiceData.Serialization.cs} (91%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{WorkloadNetworkDnsZone.Serialization.cs => WorkloadNetworkDnsZoneData.Serialization.cs} (92%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{WorkloadNetworkGateway.Serialization.cs => WorkloadNetworkGatewayData.Serialization.cs} (85%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{WorkloadNetworkPortMirroring.Serialization.cs => WorkloadNetworkPortMirroringData.Serialization.cs} (90%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{WorkloadNetworkPublicIP.Serialization.cs => WorkloadNetworkPublicIPData.Serialization.cs} (87%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{WorkloadNetworkSegment.Serialization.cs => WorkloadNetworkSegmentData.Serialization.cs} (91%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{WorkloadNetworkVMGroup.Serialization.cs => WorkloadNetworkVMGroupData.Serialization.cs} (90%) rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/{WorkloadNetworkVirtualMachine.Serialization.cs => WorkloadNetworkVirtualMachineData.Serialization.cs} (84%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdlet.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/ScriptCmdlet.cs => ScriptCmdletData.cs} (74%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/ScriptExecution.cs => ScriptExecutionData.cs} (85%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackage.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/ScriptPackage.cs => ScriptPackageData.cs} (69%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachine.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/VirtualMachine.cs => VirtualMachineData.cs} (75%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcp.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/WorkloadNetworkDhcp.cs => WorkloadNetworkDhcpData.cs} (59%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsService.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/WorkloadNetworkDnsService.cs => WorkloadNetworkDnsServiceData.cs} (77%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZone.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/WorkloadNetworkDnsZone.cs => WorkloadNetworkDnsZoneData.cs} (78%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGateway.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/WorkloadNetworkGateway.cs => WorkloadNetworkGatewayData.cs} (66%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroring.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/WorkloadNetworkPortMirroring.cs => WorkloadNetworkPortMirroringData.cs} (74%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIP.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/WorkloadNetworkPublicIP.cs => WorkloadNetworkPublicIPData.cs} (71%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/WorkloadNetworkSegment.cs => WorkloadNetworkSegmentData.cs} (76%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroup.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroupCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/WorkloadNetworkVMGroup.cs => WorkloadNetworkVMGroupData.cs} (74%) create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachine.cs create mode 100644 sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs rename sdk/avs/Azure.ResourceManager.Avs/src/Generated/{Models/WorkloadNetworkVirtualMachine.cs => WorkloadNetworkVirtualMachineData.cs} (62%) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Addon.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Addon.cs index b9e571e5e4d1..c3d6b738d788 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Addon.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Addon.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using Azure; @@ -15,15 +16,20 @@ using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { /// A Class representing a Addon along with the instance operations that can be performed on it. public partial class Addon : ArmResource { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"; + return new ResourceIdentifier(resourceId); + } private readonly ClientDiagnostics _clientDiagnostics; - private readonly AddonsRestOperations _restClient; + private readonly AddonsRestOperations _addonsRestClient; private readonly AddonData _data; /// Initializes a new instance of the class for mocking. @@ -33,13 +39,16 @@ protected Addon() /// Initializes a new instance of the class. /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal Addon(ArmResource options, AddonData resource) : base(options, resource.Id) + /// The resource that is the target of operations. + internal Addon(ArmResource options, AddonData data) : base(options, data.Id) { HasData = true; - _data = resource; + _data = data; _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _addonsRestClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -48,7 +57,10 @@ internal Addon(ArmResource options, AddonData resource) : base(options, resource internal Addon(ArmResource options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _addonsRestClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -60,15 +72,15 @@ internal Addon(ArmResource options, ResourceIdentifier id) : base(options, id) internal Addon(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _addonsRestClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/addons"; - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - /// Gets whether or not the current instance has data. public virtual bool HasData { get; } @@ -84,6 +96,12 @@ public virtual AddonData Data } } + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + /// Get an addon by name in a private cloud. /// The cancellation token to use. public async virtual Task> GetAsync(CancellationToken cancellationToken = default) @@ -92,7 +110,7 @@ public async virtual Task> GetAsync(CancellationToken cancellati scope.Start(); try { - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _addonsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new Addon(this, response.Value), response.GetRawResponse()); @@ -112,7 +130,7 @@ public virtual Response Get(CancellationToken cancellationToken = default scope.Start(); try { - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _addonsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new Addon(this, response.Value), response.GetRawResponse()); @@ -127,30 +145,50 @@ public virtual Response Get(CancellationToken cancellationToken = default /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + using var scope = _clientDiagnostics.CreateScope("Addon.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) { - return ListAvailableLocations(ResourceType, cancellationToken); + using var scope = _clientDiagnostics.CreateScope("Addon.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Delete a addon in a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("Addon.Delete"); scope.Start(); try { - var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AddonDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + var response = await _addonsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AddonDeleteOperation(_clientDiagnostics, Pipeline, _addonsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -165,14 +203,14 @@ public async virtual Task DeleteAsync(bool waitForCompleti /// Delete a addon in a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual AddonDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual AddonDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("Addon.Delete"); scope.Start(); try { - var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new AddonDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + var response = _addonsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new AddonDeleteOperation(_clientDiagnostics, Pipeline, _addonsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs index b4e6edc5bf1f..edf730810fd2 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonCollection.cs @@ -8,55 +8,46 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs { - /// A class representing collection of Addon and their operations over a PrivateCloud. + /// A class representing collection of Addon and their operations over its parent. public partial class AddonCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _clientDiagnostics; - private readonly AddonsRestOperations _restClient; + private readonly AddonsRestOperations _addonsRestClient; /// Initializes a new instance of the class for mocking. protected AddonCollection() { } - /// Initializes a new instance of AddonCollection class. + /// Initializes a new instance of the class. /// The resource representing the parent resource. internal AddonCollection(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _addonsRestClient = new AddonsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } - IEnumerator IEnumerable.GetEnumerator() + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetAll().GetEnumerator(); + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); } - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; - // Collection level operations. /// Create or update a addon in a private cloud. @@ -65,7 +56,7 @@ IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationT /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public virtual AddonCreateOrUpdateOperation CreateOrUpdate(string addonName, AddonData addon, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual AddonCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string addonName, AddonData addon, CancellationToken cancellationToken = default) { if (addonName == null) { @@ -80,8 +71,8 @@ public virtual AddonCreateOrUpdateOperation CreateOrUpdate(string addonName, Add scope.Start(); try { - var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, addonName, addon, cancellationToken); - var operation = new AddonCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, addonName, addon).Request, response); + var response = _addonsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, addon, cancellationToken); + var operation = new AddonCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _addonsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, addon).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -99,7 +90,7 @@ public virtual AddonCreateOrUpdateOperation CreateOrUpdate(string addonName, Add /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public async virtual Task CreateOrUpdateAsync(string addonName, AddonData addon, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string addonName, AddonData addon, CancellationToken cancellationToken = default) { if (addonName == null) { @@ -114,8 +105,8 @@ public async virtual Task CreateOrUpdateAsync(stri scope.Start(); try { - var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, addonName, addon, cancellationToken).ConfigureAwait(false); - var operation = new AddonCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, addonName, addon).Request, response); + var response = await _addonsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, addon, cancellationToken).ConfigureAwait(false); + var operation = new AddonCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _addonsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, addon).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -127,21 +118,22 @@ public async virtual Task CreateOrUpdateAsync(stri } } - /// Gets details for this resource from the service. + /// Get an addon by name in a private cloud. /// Name of the addon for the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response Get(string addonName, CancellationToken cancellationToken = default) { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + using var scope = _clientDiagnostics.CreateScope("AddonCollection.Get"); scope.Start(); try { - if (addonName == null) - { - throw new ArgumentNullException(nameof(addonName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken); + var response = _addonsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new Addon(Parent, response.Value), response.GetRawResponse()); @@ -153,21 +145,22 @@ public virtual Response Get(string addonName, CancellationToken cancellat } } - /// Gets details for this resource from the service. + /// Get an addon by name in a private cloud. /// Name of the addon for the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetAsync(string addonName, CancellationToken cancellationToken = default) { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + using var scope = _clientDiagnostics.CreateScope("AddonCollection.Get"); scope.Start(); try { - if (addonName == null) - { - throw new ArgumentNullException(nameof(addonName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _addonsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new Addon(Parent, response.Value), response.GetRawResponse()); @@ -181,22 +174,23 @@ public async virtual Task> GetAsync(string addonName, Cancellati /// Tries to get details for this resource from the service. /// Name of the addon for the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response GetIfExists(string addonName, CancellationToken cancellationToken = default) { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + using var scope = _clientDiagnostics.CreateScope("AddonCollection.GetIfExists"); scope.Start(); try { - if (addonName == null) - { - throw new ArgumentNullException(nameof(addonName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new Addon(this, response.Value), response.GetRawResponse()); + var response = _addonsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new Addon(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,22 +201,23 @@ public virtual Response GetIfExists(string addonName, CancellationToken c /// Tries to get details for this resource from the service. /// Name of the addon for the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetIfExistsAsync(string addonName, CancellationToken cancellationToken = default) { + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + using var scope = _clientDiagnostics.CreateScope("AddonCollection.GetIfExists"); scope.Start(); try { - if (addonName == null) - { - throw new ArgumentNullException(nameof(addonName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new Addon(this, response.Value), response.GetRawResponse()); + var response = await _addonsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, addonName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new Addon(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -233,18 +228,19 @@ public async virtual Task> GetIfExistsAsync(string addonName, Ca /// Tries to get details for this resource from the service. /// Name of the addon for the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string addonName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string addonName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("AddonCollection.CheckIfExists"); + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + using var scope = _clientDiagnostics.CreateScope("AddonCollection.Exists"); scope.Start(); try { - if (addonName == null) - { - throw new ArgumentNullException(nameof(addonName)); - } - var response = GetIfExists(addonName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -257,18 +253,19 @@ public virtual Response CheckIfExists(string addonName, CancellationToken /// Tries to get details for this resource from the service. /// Name of the addon for the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string addonName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string addonName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("AddonCollection.CheckIfExists"); + if (addonName == null) + { + throw new ArgumentNullException(nameof(addonName)); + } + + using var scope = _clientDiagnostics.CreateScope("AddonCollection.Exists"); scope.Start(); try { - if (addonName == null) - { - throw new ArgumentNullException(nameof(addonName)); - } - var response = await GetIfExistsAsync(addonName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -290,7 +287,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _addonsRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new Addon(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -305,7 +302,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _addonsRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new Addon(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -328,7 +325,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _addonsRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new Addon(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -343,7 +340,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _addonsRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new Addon(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -355,7 +352,22 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + // Builders. - // public ArmBuilder Construct() { } + // public ArmBuilder Construct() { } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs index a3d77985a008..02d3e0cccc78 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AddonData.cs @@ -5,7 +5,7 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLink.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLink.cs index 97c51b6543dd..748c1f8f8006 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLink.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLink.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using Azure; @@ -15,15 +16,20 @@ using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { /// A Class representing a CloudLink along with the instance operations that can be performed on it. public partial class CloudLink : ArmResource { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"; + return new ResourceIdentifier(resourceId); + } private readonly ClientDiagnostics _clientDiagnostics; - private readonly CloudLinksRestOperations _restClient; + private readonly CloudLinksRestOperations _cloudLinksRestClient; private readonly CloudLinkData _data; /// Initializes a new instance of the class for mocking. @@ -33,13 +39,16 @@ protected CloudLink() /// Initializes a new instance of the class. /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal CloudLink(ArmResource options, CloudLinkData resource) : base(options, resource.Id) + /// The resource that is the target of operations. + internal CloudLink(ArmResource options, CloudLinkData data) : base(options, data.Id) { HasData = true; - _data = resource; + _data = data; _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _cloudLinksRestClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -48,7 +57,10 @@ internal CloudLink(ArmResource options, CloudLinkData resource) : base(options, internal CloudLink(ArmResource options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _cloudLinksRestClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -60,15 +72,15 @@ internal CloudLink(ArmResource options, ResourceIdentifier id) : base(options, i internal CloudLink(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _cloudLinksRestClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/cloudLinks"; - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - /// Gets whether or not the current instance has data. public virtual bool HasData { get; } @@ -84,6 +96,12 @@ public virtual CloudLinkData Data } } + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + /// Get an cloud link by name in a private cloud. /// The cancellation token to use. public async virtual Task> GetAsync(CancellationToken cancellationToken = default) @@ -92,7 +110,7 @@ public async virtual Task> GetAsync(CancellationToken cancel scope.Start(); try { - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _cloudLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new CloudLink(this, response.Value), response.GetRawResponse()); @@ -112,7 +130,7 @@ public virtual Response Get(CancellationToken cancellationToken = def scope.Start(); try { - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _cloudLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new CloudLink(this, response.Value), response.GetRawResponse()); @@ -127,30 +145,50 @@ public virtual Response Get(CancellationToken cancellationToken = def /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + using var scope = _clientDiagnostics.CreateScope("CloudLink.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) { - return ListAvailableLocations(ResourceType, cancellationToken); + using var scope = _clientDiagnostics.CreateScope("CloudLink.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Delete a cloud link in a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("CloudLink.Delete"); scope.Start(); try { - var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new CloudLinkDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + var response = await _cloudLinksRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new CloudLinkDeleteOperation(_clientDiagnostics, Pipeline, _cloudLinksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -165,14 +203,14 @@ public async virtual Task DeleteAsync(bool waitForComp /// Delete a cloud link in a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual CloudLinkDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual CloudLinkDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("CloudLink.Delete"); scope.Start(); try { - var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new CloudLinkDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + var response = _cloudLinksRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new CloudLinkDeleteOperation(_clientDiagnostics, Pipeline, _cloudLinksRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs index 140646bb1ab1..f85ee61b6603 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkCollection.cs @@ -8,55 +8,46 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs { - /// A class representing collection of CloudLink and their operations over a PrivateCloud. + /// A class representing collection of CloudLink and their operations over its parent. public partial class CloudLinkCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _clientDiagnostics; - private readonly CloudLinksRestOperations _restClient; + private readonly CloudLinksRestOperations _cloudLinksRestClient; /// Initializes a new instance of the class for mocking. protected CloudLinkCollection() { } - /// Initializes a new instance of CloudLinkCollection class. + /// Initializes a new instance of the class. /// The resource representing the parent resource. internal CloudLinkCollection(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _cloudLinksRestClient = new CloudLinksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } - IEnumerator IEnumerable.GetEnumerator() + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetAll().GetEnumerator(); + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); } - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; - // Collection level operations. /// Create or update a cloud link in a private cloud. @@ -65,7 +56,7 @@ IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(Cance /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public virtual CloudLinkCreateOrUpdateOperation CreateOrUpdate(string cloudLinkName, CloudLinkData cloudLink, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual CloudLinkCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string cloudLinkName, CloudLinkData cloudLink, CancellationToken cancellationToken = default) { if (cloudLinkName == null) { @@ -80,8 +71,8 @@ public virtual CloudLinkCreateOrUpdateOperation CreateOrUpdate(string cloudLinkN scope.Start(); try { - var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink, cancellationToken); - var operation = new CloudLinkCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink).Request, response); + var response = _cloudLinksRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink, cancellationToken); + var operation = new CloudLinkCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _cloudLinksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -99,7 +90,7 @@ public virtual CloudLinkCreateOrUpdateOperation CreateOrUpdate(string cloudLinkN /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public async virtual Task CreateOrUpdateAsync(string cloudLinkName, CloudLinkData cloudLink, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string cloudLinkName, CloudLinkData cloudLink, CancellationToken cancellationToken = default) { if (cloudLinkName == null) { @@ -114,8 +105,8 @@ public async virtual Task CreateOrUpdateAsync( scope.Start(); try { - var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink, cancellationToken).ConfigureAwait(false); - var operation = new CloudLinkCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink).Request, response); + var response = await _cloudLinksRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink, cancellationToken).ConfigureAwait(false); + var operation = new CloudLinkCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _cloudLinksRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cloudLink).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -127,21 +118,22 @@ public async virtual Task CreateOrUpdateAsync( } } - /// Gets details for this resource from the service. + /// Get an cloud link by name in a private cloud. /// Name of the cloud link resource. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response Get(string cloudLinkName, CancellationToken cancellationToken = default) { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.Get"); scope.Start(); try { - if (cloudLinkName == null) - { - throw new ArgumentNullException(nameof(cloudLinkName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken); + var response = _cloudLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new CloudLink(Parent, response.Value), response.GetRawResponse()); @@ -153,21 +145,22 @@ public virtual Response Get(string cloudLinkName, CancellationToken c } } - /// Gets details for this resource from the service. + /// Get an cloud link by name in a private cloud. /// Name of the cloud link resource. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetAsync(string cloudLinkName, CancellationToken cancellationToken = default) { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.Get"); scope.Start(); try { - if (cloudLinkName == null) - { - throw new ArgumentNullException(nameof(cloudLinkName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _cloudLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new CloudLink(Parent, response.Value), response.GetRawResponse()); @@ -181,22 +174,23 @@ public async virtual Task> GetAsync(string cloudLinkName, Ca /// Tries to get details for this resource from the service. /// Name of the cloud link resource. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response GetIfExists(string cloudLinkName, CancellationToken cancellationToken = default) { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.GetIfExists"); scope.Start(); try { - if (cloudLinkName == null) - { - throw new ArgumentNullException(nameof(cloudLinkName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new CloudLink(this, response.Value), response.GetRawResponse()); + var response = _cloudLinksRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new CloudLink(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,22 +201,23 @@ public virtual Response GetIfExists(string cloudLinkName, Cancellatio /// Tries to get details for this resource from the service. /// Name of the cloud link resource. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetIfExistsAsync(string cloudLinkName, CancellationToken cancellationToken = default) { + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.GetIfExists"); scope.Start(); try { - if (cloudLinkName == null) - { - throw new ArgumentNullException(nameof(cloudLinkName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new CloudLink(this, response.Value), response.GetRawResponse()); + var response = await _cloudLinksRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new CloudLink(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -233,18 +228,19 @@ public async virtual Task> GetIfExistsAsync(string cloudLink /// Tries to get details for this resource from the service. /// Name of the cloud link resource. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string cloudLinkName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string cloudLinkName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.CheckIfExists"); + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.Exists"); scope.Start(); try { - if (cloudLinkName == null) - { - throw new ArgumentNullException(nameof(cloudLinkName)); - } - var response = GetIfExists(cloudLinkName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -257,18 +253,19 @@ public virtual Response CheckIfExists(string cloudLinkName, CancellationTo /// Tries to get details for this resource from the service. /// Name of the cloud link resource. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string cloudLinkName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string cloudLinkName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.CheckIfExists"); + if (cloudLinkName == null) + { + throw new ArgumentNullException(nameof(cloudLinkName)); + } + + using var scope = _clientDiagnostics.CreateScope("CloudLinkCollection.Exists"); scope.Start(); try { - if (cloudLinkName == null) - { - throw new ArgumentNullException(nameof(cloudLinkName)); - } - var response = await GetIfExistsAsync(cloudLinkName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -290,7 +287,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _cloudLinksRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new CloudLink(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -305,7 +302,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _cloudLinksRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new CloudLink(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -328,7 +325,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _cloudLinksRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new CloudLink(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -343,7 +340,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _cloudLinksRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new CloudLink(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -355,7 +352,22 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + // Builders. - // public ArmBuilder Construct() { } + // public ArmBuilder Construct() { } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs index e585bbafc96f..f3017bd4ae7a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/CloudLinkData.cs @@ -5,7 +5,7 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Cluster.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Cluster.cs index a2cb79d41e0d..51abf28c536b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Cluster.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Cluster.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using Azure; @@ -15,17 +16,21 @@ using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { /// A Class representing a Cluster along with the instance operations that can be performed on it. public partial class Cluster : ArmResource { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"; + return new ResourceIdentifier(resourceId); + } private readonly ClientDiagnostics _clientDiagnostics; - private readonly ClustersRestOperations _restClient; + private readonly ClustersRestOperations _clustersRestClient; private readonly ClusterData _data; - private VirtualMachinesRestOperations _virtualMachinesRestClient { get; } /// Initializes a new instance of the class for mocking. protected Cluster() @@ -34,14 +39,16 @@ protected Cluster() /// Initializes a new instance of the class. /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal Cluster(ArmResource options, ClusterData resource) : base(options, resource.Id) + /// The resource that is the target of operations. + internal Cluster(ArmResource options, ClusterData data) : base(options, data.Id) { HasData = true; - _data = resource; + _data = data; _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _virtualMachinesRestClient = new VirtualMachinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _clustersRestClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -50,8 +57,10 @@ internal Cluster(ArmResource options, ClusterData resource) : base(options, reso internal Cluster(ArmResource options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _virtualMachinesRestClient = new VirtualMachinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _clustersRestClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -63,16 +72,15 @@ internal Cluster(ArmResource options, ResourceIdentifier id) : base(options, id) internal Cluster(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _virtualMachinesRestClient = new VirtualMachinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _clustersRestClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters"; - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - /// Gets whether or not the current instance has data. public virtual bool HasData { get; } @@ -88,6 +96,12 @@ public virtual ClusterData Data } } + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + /// Get a cluster by name in a private cloud. /// The cancellation token to use. public async virtual Task> GetAsync(CancellationToken cancellationToken = default) @@ -96,7 +110,7 @@ public async virtual Task> GetAsync(CancellationToken cancella scope.Start(); try { - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _clustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new Cluster(this, response.Value), response.GetRawResponse()); @@ -116,7 +130,7 @@ public virtual Response Get(CancellationToken cancellationToken = defau scope.Start(); try { - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _clustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new Cluster(this, response.Value), response.GetRawResponse()); @@ -131,33 +145,13 @@ public virtual Response Get(CancellationToken cancellationToken = defau /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) - { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); - } - - /// Lists all available geo-locations. - /// A token to allow the caller to cancel the call to the service. The default value is . - /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) - { - return ListAvailableLocations(ResourceType, cancellationToken); - } - - /// Delete a cluster in a private cloud. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("Cluster.Delete"); + using var scope = _clientDiagnostics.CreateScope("Cluster.GetAvailableLocations"); scope.Start(); try { - var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ClusterDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); } catch (Exception e) { @@ -166,20 +160,16 @@ public async virtual Task DeleteAsync(bool waitForComple } } - /// Delete a cluster in a private cloud. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual ClusterDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("Cluster.Delete"); + using var scope = _clientDiagnostics.CreateScope("Cluster.GetAvailableLocations"); scope.Start(); try { - var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ClusterDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; + return ListAvailableLocations(ResourceType, cancellationToken); } catch (Exception e) { @@ -187,16 +177,21 @@ public virtual ClusterDeleteOperation Delete(bool waitForCompletion = true, Canc throw; } } - /// Get a virtual machine by id in a private cloud cluster. + + /// Delete a cluster in a private cloud. + /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual async Task> GetVirtualMachineAsync(CancellationToken cancellationToken = default) + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachine"); + using var scope = _clientDiagnostics.CreateScope("Cluster.Delete"); scope.Start(); try { - var response = await _virtualMachinesRestClient.GetAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; + var response = await _clustersRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ClusterDeleteOperation(_clientDiagnostics, Pipeline, _clustersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; } catch (Exception e) { @@ -205,16 +200,20 @@ public virtual async Task> GetVirtualMachineAsync(Cance } } - /// Get a virtual machine by id in a private cloud cluster. + /// Delete a cluster in a private cloud. + /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual Response GetVirtualMachine(CancellationToken cancellationToken = default) + public virtual ClusterDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachine"); + using var scope = _clientDiagnostics.CreateScope("Cluster.Delete"); scope.Start(); try { - var response = _virtualMachinesRestClient.Get(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - return response; + var response = _clustersRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ClusterDeleteOperation(_clientDiagnostics, Pipeline, _clustersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; } catch (Exception e) { @@ -223,88 +222,12 @@ public virtual Response GetVirtualMachine(CancellationToken canc } } - /// List of virtual machines in a private cloud cluster. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetVirtualMachines(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachines"); - scope.Start(); - try - { - var response = _virtualMachinesRestClient.GetAll(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachines"); - scope.Start(); - try - { - var response = _virtualMachinesRestClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of virtual machines in a private cloud cluster. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetVirtualMachinesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachines"); - scope.Start(); - try - { - var response = await _virtualMachinesRestClient.GetAllAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("Cluster.GetVirtualMachines"); - scope.Start(); - try - { - var response = await _virtualMachinesRestClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - /// Update a cluster in a private cloud. /// The cluster properties to be updated. /// Waits for the completion of the long running operations. /// The cancellation token to use. /// is null. - public async virtual Task UpdateAsync(ClusterUpdate clusterUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task UpdateAsync(bool waitForCompletion, ClusterUpdate clusterUpdate, CancellationToken cancellationToken = default) { if (clusterUpdate == null) { @@ -315,8 +238,8 @@ public async virtual Task UpdateAsync(ClusterUpdate clus scope.Start(); try { - var response = await _restClient.UpdateAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate, cancellationToken).ConfigureAwait(false); - var operation = new ClusterUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate).Request, response); + var response = await _clustersRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate, cancellationToken).ConfigureAwait(false); + var operation = new ClusterUpdateOperation(this, _clientDiagnostics, Pipeline, _clustersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -333,7 +256,7 @@ public async virtual Task UpdateAsync(ClusterUpdate clus /// Waits for the completion of the long running operations. /// The cancellation token to use. /// is null. - public virtual ClusterUpdateOperation Update(ClusterUpdate clusterUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual ClusterUpdateOperation Update(bool waitForCompletion, ClusterUpdate clusterUpdate, CancellationToken cancellationToken = default) { if (clusterUpdate == null) { @@ -344,8 +267,8 @@ public virtual ClusterUpdateOperation Update(ClusterUpdate clusterUpdate, bool w scope.Start(); try { - var response = _restClient.Update(Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate, cancellationToken); - var operation = new ClusterUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate).Request, response); + var response = _clustersRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate, cancellationToken); + var operation = new ClusterUpdateOperation(this, _clientDiagnostics, Pipeline, _clustersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, clusterUpdate).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -357,18 +280,34 @@ public virtual ClusterUpdateOperation Update(ClusterUpdate clusterUpdate, bool w } } - /// Gets a list of Datastores in the Cluster. + #region Datastore + + /// Gets a collection of Datastores in the Cluster. /// An object representing collection of Datastores and their operations over a Cluster. - public DatastoreCollection GetDatastores() + public virtual DatastoreCollection GetDatastores() { return new DatastoreCollection(this); } + #endregion + + #region VirtualMachine + + /// Gets a collection of VirtualMachines in the Cluster. + /// An object representing collection of VirtualMachines and their operations over a Cluster. + public virtual VirtualMachineCollection GetVirtualMachines() + { + return new VirtualMachineCollection(this); + } + #endregion + + #region PlacementPolicy - /// Gets a list of PlacementPolicies in the Cluster. + /// Gets a collection of PlacementPolicies in the Cluster. /// An object representing collection of PlacementPolicies and their operations over a Cluster. - public PlacementPolicyCollection GetPlacementPolicies() + public virtual PlacementPolicyCollection GetPlacementPolicies() { return new PlacementPolicyCollection(this); } + #endregion } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs index 119b14162376..e851dd499b47 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterCollection.cs @@ -8,55 +8,46 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs { - /// A class representing collection of Cluster and their operations over a PrivateCloud. + /// A class representing collection of Cluster and their operations over its parent. public partial class ClusterCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _clientDiagnostics; - private readonly ClustersRestOperations _restClient; + private readonly ClustersRestOperations _clustersRestClient; /// Initializes a new instance of the class for mocking. protected ClusterCollection() { } - /// Initializes a new instance of ClusterCollection class. + /// Initializes a new instance of the class. /// The resource representing the parent resource. internal ClusterCollection(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _clustersRestClient = new ClustersRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } - IEnumerator IEnumerable.GetEnumerator() + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetAll().GetEnumerator(); + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); } - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; - // Collection level operations. /// Create or update a cluster in a private cloud. @@ -65,7 +56,7 @@ IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(Cancellat /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public virtual ClusterCreateOrUpdateOperation CreateOrUpdate(string clusterName, ClusterData cluster, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual ClusterCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string clusterName, ClusterData cluster, CancellationToken cancellationToken = default) { if (clusterName == null) { @@ -80,8 +71,8 @@ public virtual ClusterCreateOrUpdateOperation CreateOrUpdate(string clusterName, scope.Start(); try { - var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, clusterName, cluster, cancellationToken); - var operation = new ClusterCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, clusterName, cluster).Request, response); + var response = _clustersRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cluster, cancellationToken); + var operation = new ClusterCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _clustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cluster).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -99,7 +90,7 @@ public virtual ClusterCreateOrUpdateOperation CreateOrUpdate(string clusterName, /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public async virtual Task CreateOrUpdateAsync(string clusterName, ClusterData cluster, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string clusterName, ClusterData cluster, CancellationToken cancellationToken = default) { if (clusterName == null) { @@ -114,8 +105,8 @@ public async virtual Task CreateOrUpdateAsync(st scope.Start(); try { - var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, clusterName, cluster, cancellationToken).ConfigureAwait(false); - var operation = new ClusterCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, clusterName, cluster).Request, response); + var response = await _clustersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cluster, cancellationToken).ConfigureAwait(false); + var operation = new ClusterCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _clustersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cluster).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -127,21 +118,22 @@ public async virtual Task CreateOrUpdateAsync(st } } - /// Gets details for this resource from the service. + /// Get a cluster by name in a private cloud. /// Name of the cluster in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response Get(string clusterName, CancellationToken cancellationToken = default) { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.Get"); scope.Start(); try { - if (clusterName == null) - { - throw new ArgumentNullException(nameof(clusterName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); + var response = _clustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new Cluster(Parent, response.Value), response.GetRawResponse()); @@ -153,21 +145,22 @@ public virtual Response Get(string clusterName, CancellationToken cance } } - /// Gets details for this resource from the service. + /// Get a cluster by name in a private cloud. /// Name of the cluster in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetAsync(string clusterName, CancellationToken cancellationToken = default) { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.Get"); scope.Start(); try { - if (clusterName == null) - { - throw new ArgumentNullException(nameof(clusterName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _clustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new Cluster(Parent, response.Value), response.GetRawResponse()); @@ -181,22 +174,23 @@ public async virtual Task> GetAsync(string clusterName, Cancel /// Tries to get details for this resource from the service. /// Name of the cluster in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response GetIfExists(string clusterName, CancellationToken cancellationToken = default) { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.GetIfExists"); scope.Start(); try { - if (clusterName == null) - { - throw new ArgumentNullException(nameof(clusterName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new Cluster(this, response.Value), response.GetRawResponse()); + var response = _clustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new Cluster(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,22 +201,23 @@ public virtual Response GetIfExists(string clusterName, CancellationTok /// Tries to get details for this resource from the service. /// Name of the cluster in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) { + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.GetIfExists"); scope.Start(); try { - if (clusterName == null) - { - throw new ArgumentNullException(nameof(clusterName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new Cluster(this, response.Value), response.GetRawResponse()); + var response = await _clustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new Cluster(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -233,18 +228,19 @@ public async virtual Task> GetIfExistsAsync(string clusterName /// Tries to get details for this resource from the service. /// Name of the cluster in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string clusterName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string clusterName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ClusterCollection.CheckIfExists"); + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.Exists"); scope.Start(); try { - if (clusterName == null) - { - throw new ArgumentNullException(nameof(clusterName)); - } - var response = GetIfExists(clusterName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -257,18 +253,19 @@ public virtual Response CheckIfExists(string clusterName, CancellationToke /// Tries to get details for this resource from the service. /// Name of the cluster in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string clusterName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string clusterName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ClusterCollection.CheckIfExists"); + if (clusterName == null) + { + throw new ArgumentNullException(nameof(clusterName)); + } + + using var scope = _clientDiagnostics.CreateScope("ClusterCollection.Exists"); scope.Start(); try { - if (clusterName == null) - { - throw new ArgumentNullException(nameof(clusterName)); - } - var response = await GetIfExistsAsync(clusterName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -290,7 +287,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _clustersRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new Cluster(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -305,7 +302,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _clustersRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new Cluster(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -328,7 +325,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _clustersRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new Cluster(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -343,7 +340,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _clustersRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new Cluster(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -355,7 +352,22 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + // Builders. - // public ArmBuilder Construct() { } + // public ArmBuilder Construct() { } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs index 5ecb951a7731..56f0ef452146 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ClusterData.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Datastore.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Datastore.cs index d15d9e35023d..68945d730953 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Datastore.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Datastore.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using Azure; @@ -15,15 +16,20 @@ using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { /// A Class representing a Datastore along with the instance operations that can be performed on it. public partial class Datastore : ArmResource { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"; + return new ResourceIdentifier(resourceId); + } private readonly ClientDiagnostics _clientDiagnostics; - private readonly DatastoresRestOperations _restClient; + private readonly DatastoresRestOperations _datastoresRestClient; private readonly DatastoreData _data; /// Initializes a new instance of the class for mocking. @@ -33,13 +39,16 @@ protected Datastore() /// Initializes a new instance of the class. /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal Datastore(ArmResource options, DatastoreData resource) : base(options, resource.Id) + /// The resource that is the target of operations. + internal Datastore(ArmResource options, DatastoreData data) : base(options, data.Id) { HasData = true; - _data = resource; + _data = data; _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _datastoresRestClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -48,7 +57,10 @@ internal Datastore(ArmResource options, DatastoreData resource) : base(options, internal Datastore(ArmResource options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _datastoresRestClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -60,15 +72,15 @@ internal Datastore(ArmResource options, ResourceIdentifier id) : base(options, i internal Datastore(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _datastoresRestClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters/datastores"; - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - /// Gets whether or not the current instance has data. public virtual bool HasData { get; } @@ -84,6 +96,12 @@ public virtual DatastoreData Data } } + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + /// Get a datastore in a private cloud cluster. /// The cancellation token to use. public async virtual Task> GetAsync(CancellationToken cancellationToken = default) @@ -92,7 +110,7 @@ public async virtual Task> GetAsync(CancellationToken cancel scope.Start(); try { - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _datastoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new Datastore(this, response.Value), response.GetRawResponse()); @@ -112,7 +130,7 @@ public virtual Response Get(CancellationToken cancellationToken = def scope.Start(); try { - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _datastoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new Datastore(this, response.Value), response.GetRawResponse()); @@ -127,30 +145,50 @@ public virtual Response Get(CancellationToken cancellationToken = def /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + using var scope = _clientDiagnostics.CreateScope("Datastore.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) { - return ListAvailableLocations(ResourceType, cancellationToken); + using var scope = _clientDiagnostics.CreateScope("Datastore.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Delete a datastore in a private cloud cluster. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("Datastore.Delete"); scope.Start(); try { - var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new DatastoreDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); + var response = await _datastoresRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatastoreDeleteOperation(_clientDiagnostics, Pipeline, _datastoresRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -165,14 +203,14 @@ public async virtual Task DeleteAsync(bool waitForComp /// Delete a datastore in a private cloud cluster. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual DatastoreDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual DatastoreDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("Datastore.Delete"); scope.Start(); try { - var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new DatastoreDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); + var response = _datastoresRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DatastoreDeleteOperation(_clientDiagnostics, Pipeline, _datastoresRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs index 9bbb9c58a101..8cef8d0242a1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreCollection.cs @@ -8,55 +8,46 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs { - /// A class representing collection of Datastore and their operations over a Cluster. + /// A class representing collection of Datastore and their operations over its parent. public partial class DatastoreCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _clientDiagnostics; - private readonly DatastoresRestOperations _restClient; + private readonly DatastoresRestOperations _datastoresRestClient; /// Initializes a new instance of the class for mocking. protected DatastoreCollection() { } - /// Initializes a new instance of DatastoreCollection class. + /// Initializes a new instance of the class. /// The resource representing the parent resource. internal DatastoreCollection(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _datastoresRestClient = new DatastoresRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } - IEnumerator IEnumerable.GetEnumerator() + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetAll().GetEnumerator(); + if (id.ResourceType != Cluster.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, Cluster.ResourceType), nameof(id)); } - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => Cluster.ResourceType; - // Collection level operations. /// Create or update a datastore in a private cloud cluster. @@ -65,7 +56,7 @@ IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(Cance /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public virtual DatastoreCreateOrUpdateOperation CreateOrUpdate(string datastoreName, DatastoreData datastore, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual DatastoreCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string datastoreName, DatastoreData datastore, CancellationToken cancellationToken = default) { if (datastoreName == null) { @@ -80,8 +71,8 @@ public virtual DatastoreCreateOrUpdateOperation CreateOrUpdate(string datastoreN scope.Start(); try { - var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore, cancellationToken); - var operation = new DatastoreCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore).Request, response); + var response = _datastoresRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore, cancellationToken); + var operation = new DatastoreCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _datastoresRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -99,7 +90,7 @@ public virtual DatastoreCreateOrUpdateOperation CreateOrUpdate(string datastoreN /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public async virtual Task CreateOrUpdateAsync(string datastoreName, DatastoreData datastore, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string datastoreName, DatastoreData datastore, CancellationToken cancellationToken = default) { if (datastoreName == null) { @@ -114,8 +105,8 @@ public async virtual Task CreateOrUpdateAsync( scope.Start(); try { - var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore, cancellationToken).ConfigureAwait(false); - var operation = new DatastoreCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore).Request, response); + var response = await _datastoresRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore, cancellationToken).ConfigureAwait(false); + var operation = new DatastoreCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _datastoresRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, datastore).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -127,21 +118,22 @@ public async virtual Task CreateOrUpdateAsync( } } - /// Gets details for this resource from the service. + /// Get a datastore in a private cloud cluster. /// Name of the datastore in the private cloud cluster. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response Get(string datastoreName, CancellationToken cancellationToken = default) { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.Get"); scope.Start(); try { - if (datastoreName == null) - { - throw new ArgumentNullException(nameof(datastoreName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken); + var response = _datastoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new Datastore(Parent, response.Value), response.GetRawResponse()); @@ -153,21 +145,22 @@ public virtual Response Get(string datastoreName, CancellationToken c } } - /// Gets details for this resource from the service. + /// Get a datastore in a private cloud cluster. /// Name of the datastore in the private cloud cluster. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetAsync(string datastoreName, CancellationToken cancellationToken = default) { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.Get"); scope.Start(); try { - if (datastoreName == null) - { - throw new ArgumentNullException(nameof(datastoreName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _datastoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new Datastore(Parent, response.Value), response.GetRawResponse()); @@ -181,22 +174,23 @@ public async virtual Task> GetAsync(string datastoreName, Ca /// Tries to get details for this resource from the service. /// Name of the datastore in the private cloud cluster. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response GetIfExists(string datastoreName, CancellationToken cancellationToken = default) { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.GetIfExists"); scope.Start(); try { - if (datastoreName == null) - { - throw new ArgumentNullException(nameof(datastoreName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new Datastore(this, response.Value), response.GetRawResponse()); + var response = _datastoresRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new Datastore(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,22 +201,23 @@ public virtual Response GetIfExists(string datastoreName, Cancellatio /// Tries to get details for this resource from the service. /// Name of the datastore in the private cloud cluster. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetIfExistsAsync(string datastoreName, CancellationToken cancellationToken = default) { + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.GetIfExists"); scope.Start(); try { - if (datastoreName == null) - { - throw new ArgumentNullException(nameof(datastoreName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new Datastore(this, response.Value), response.GetRawResponse()); + var response = await _datastoresRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new Datastore(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -233,18 +228,19 @@ public async virtual Task> GetIfExistsAsync(string datastore /// Tries to get details for this resource from the service. /// Name of the datastore in the private cloud cluster. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string datastoreName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string datastoreName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.CheckIfExists"); + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.Exists"); scope.Start(); try { - if (datastoreName == null) - { - throw new ArgumentNullException(nameof(datastoreName)); - } - var response = GetIfExists(datastoreName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -257,18 +253,19 @@ public virtual Response CheckIfExists(string datastoreName, CancellationTo /// Tries to get details for this resource from the service. /// Name of the datastore in the private cloud cluster. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string datastoreName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string datastoreName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.CheckIfExists"); + if (datastoreName == null) + { + throw new ArgumentNullException(nameof(datastoreName)); + } + + using var scope = _clientDiagnostics.CreateScope("DatastoreCollection.Exists"); scope.Start(); try { - if (datastoreName == null) - { - throw new ArgumentNullException(nameof(datastoreName)); - } - var response = await GetIfExistsAsync(datastoreName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -290,7 +287,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAll(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + var response = _datastoresRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new Datastore(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -305,7 +302,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + var response = _datastoresRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new Datastore(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -328,7 +325,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _datastoresRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new Datastore(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -343,7 +340,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _datastoresRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new Datastore(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -355,7 +352,22 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + // Builders. - // public ArmBuilder Construct() { } + // public ArmBuilder Construct() { } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs index 784b4a5c8f5a..cff5bfd9268d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/DatastoreData.cs @@ -5,7 +5,7 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorization.cs index 02431c803d1d..4b7181939e8e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorization.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using Azure; @@ -15,15 +16,20 @@ using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { /// A Class representing a ExpressRouteAuthorization along with the instance operations that can be performed on it. public partial class ExpressRouteAuthorization : ArmResource { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"; + return new ResourceIdentifier(resourceId); + } private readonly ClientDiagnostics _clientDiagnostics; - private readonly AuthorizationsRestOperations _restClient; + private readonly AuthorizationsRestOperations _authorizationsRestClient; private readonly ExpressRouteAuthorizationData _data; /// Initializes a new instance of the class for mocking. @@ -33,13 +39,16 @@ protected ExpressRouteAuthorization() /// Initializes a new instance of the class. /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal ExpressRouteAuthorization(ArmResource options, ExpressRouteAuthorizationData resource) : base(options, resource.Id) + /// The resource that is the target of operations. + internal ExpressRouteAuthorization(ArmResource options, ExpressRouteAuthorizationData data) : base(options, data.Id) { HasData = true; - _data = resource; + _data = data; _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _authorizationsRestClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -48,7 +57,10 @@ internal ExpressRouteAuthorization(ArmResource options, ExpressRouteAuthorizatio internal ExpressRouteAuthorization(ArmResource options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _authorizationsRestClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -60,15 +72,15 @@ internal ExpressRouteAuthorization(ArmResource options, ResourceIdentifier id) : internal ExpressRouteAuthorization(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _authorizationsRestClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/authorizations"; - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - /// Gets whether or not the current instance has data. public virtual bool HasData { get; } @@ -84,6 +96,12 @@ public virtual ExpressRouteAuthorizationData Data } } + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + /// Get an ExpressRoute Circuit Authorization by name in a private cloud. /// The cancellation token to use. public async virtual Task> GetAsync(CancellationToken cancellationToken = default) @@ -92,7 +110,7 @@ public async virtual Task> GetAsync(Cancella scope.Start(); try { - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _authorizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new ExpressRouteAuthorization(this, response.Value), response.GetRawResponse()); @@ -112,7 +130,7 @@ public virtual Response Get(CancellationToken cancell scope.Start(); try { - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _authorizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new ExpressRouteAuthorization(this, response.Value), response.GetRawResponse()); @@ -127,30 +145,50 @@ public virtual Response Get(CancellationToken cancell /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorization.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) { - return ListAvailableLocations(ResourceType, cancellationToken); + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorization.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Delete an ExpressRoute Circuit Authorization in a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorization.Delete"); scope.Start(); try { - var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new AuthorizationDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + var response = await _authorizationsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AuthorizationDeleteOperation(_clientDiagnostics, Pipeline, _authorizationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -165,14 +203,14 @@ public async virtual Task DeleteAsync(bool waitFor /// Delete an ExpressRoute Circuit Authorization in a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual AuthorizationDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual AuthorizationDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorization.Delete"); scope.Start(); try { - var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new AuthorizationDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + var response = _authorizationsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new AuthorizationDeleteOperation(_clientDiagnostics, Pipeline, _authorizationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs index d800e0566dbc..3d82d2ed7e3d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationCollection.cs @@ -8,55 +8,46 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs { - /// A class representing collection of ExpressRouteAuthorization and their operations over a PrivateCloud. + /// A class representing collection of ExpressRouteAuthorization and their operations over its parent. public partial class ExpressRouteAuthorizationCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _clientDiagnostics; - private readonly AuthorizationsRestOperations _restClient; + private readonly AuthorizationsRestOperations _authorizationsRestClient; /// Initializes a new instance of the class for mocking. protected ExpressRouteAuthorizationCollection() { } - /// Initializes a new instance of ExpressRouteAuthorizationCollection class. + /// Initializes a new instance of the class. /// The resource representing the parent resource. internal ExpressRouteAuthorizationCollection(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _authorizationsRestClient = new AuthorizationsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } - IEnumerator IEnumerable.GetEnumerator() + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetAll().GetEnumerator(); + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); } - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; - // Collection level operations. /// Create or update an ExpressRoute Circuit Authorization in a private cloud. @@ -65,7 +56,7 @@ IAsyncEnumerator IAsyncEnumerable Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public virtual AuthorizationCreateOrUpdateOperation CreateOrUpdate(string authorizationName, ExpressRouteAuthorizationData authorization, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual AuthorizationCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string authorizationName, ExpressRouteAuthorizationData authorization, CancellationToken cancellationToken = default) { if (authorizationName == null) { @@ -80,8 +71,8 @@ public virtual AuthorizationCreateOrUpdateOperation CreateOrUpdate(string author scope.Start(); try { - var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, authorizationName, authorization, cancellationToken); - var operation = new AuthorizationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, authorizationName, authorization).Request, response); + var response = _authorizationsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, authorization, cancellationToken); + var operation = new AuthorizationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _authorizationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, authorization).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -99,7 +90,7 @@ public virtual AuthorizationCreateOrUpdateOperation CreateOrUpdate(string author /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public async virtual Task CreateOrUpdateAsync(string authorizationName, ExpressRouteAuthorizationData authorization, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string authorizationName, ExpressRouteAuthorizationData authorization, CancellationToken cancellationToken = default) { if (authorizationName == null) { @@ -114,8 +105,8 @@ public async virtual Task CreateOrUpdateAs scope.Start(); try { - var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, authorizationName, authorization, cancellationToken).ConfigureAwait(false); - var operation = new AuthorizationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, authorizationName, authorization).Request, response); + var response = await _authorizationsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, authorization, cancellationToken).ConfigureAwait(false); + var operation = new AuthorizationCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _authorizationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, authorization).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -127,21 +118,22 @@ public async virtual Task CreateOrUpdateAs } } - /// Gets details for this resource from the service. + /// Get an ExpressRoute Circuit Authorization by name in a private cloud. /// Name of the ExpressRoute Circuit Authorization in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response Get(string authorizationName, CancellationToken cancellationToken = default) { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.Get"); scope.Start(); try { - if (authorizationName == null) - { - throw new ArgumentNullException(nameof(authorizationName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken); + var response = _authorizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new ExpressRouteAuthorization(Parent, response.Value), response.GetRawResponse()); @@ -153,21 +145,22 @@ public virtual Response Get(string authorizationName, } } - /// Gets details for this resource from the service. + /// Get an ExpressRoute Circuit Authorization by name in a private cloud. /// Name of the ExpressRoute Circuit Authorization in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetAsync(string authorizationName, CancellationToken cancellationToken = default) { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.Get"); scope.Start(); try { - if (authorizationName == null) - { - throw new ArgumentNullException(nameof(authorizationName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _authorizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new ExpressRouteAuthorization(Parent, response.Value), response.GetRawResponse()); @@ -181,22 +174,23 @@ public async virtual Task> GetAsync(string a /// Tries to get details for this resource from the service. /// Name of the ExpressRoute Circuit Authorization in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response GetIfExists(string authorizationName, CancellationToken cancellationToken = default) { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.GetIfExists"); scope.Start(); try { - if (authorizationName == null) - { - throw new ArgumentNullException(nameof(authorizationName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new ExpressRouteAuthorization(this, response.Value), response.GetRawResponse()); + var response = _authorizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new ExpressRouteAuthorization(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,22 +201,23 @@ public virtual Response GetIfExists(string authorizat /// Tries to get details for this resource from the service. /// Name of the ExpressRoute Circuit Authorization in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetIfExistsAsync(string authorizationName, CancellationToken cancellationToken = default) { + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.GetIfExists"); scope.Start(); try { - if (authorizationName == null) - { - throw new ArgumentNullException(nameof(authorizationName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new ExpressRouteAuthorization(this, response.Value), response.GetRawResponse()); + var response = await _authorizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new ExpressRouteAuthorization(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -233,18 +228,19 @@ public async virtual Task> GetIfExistsAsync( /// Tries to get details for this resource from the service. /// Name of the ExpressRoute Circuit Authorization in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string authorizationName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string authorizationName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.CheckIfExists"); + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.Exists"); scope.Start(); try { - if (authorizationName == null) - { - throw new ArgumentNullException(nameof(authorizationName)); - } - var response = GetIfExists(authorizationName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -257,18 +253,19 @@ public virtual Response CheckIfExists(string authorizationName, Cancellati /// Tries to get details for this resource from the service. /// Name of the ExpressRoute Circuit Authorization in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string authorizationName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string authorizationName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.CheckIfExists"); + if (authorizationName == null) + { + throw new ArgumentNullException(nameof(authorizationName)); + } + + using var scope = _clientDiagnostics.CreateScope("ExpressRouteAuthorizationCollection.Exists"); scope.Start(); try { - if (authorizationName == null) - { - throw new ArgumentNullException(nameof(authorizationName)); - } - var response = await GetIfExistsAsync(authorizationName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -290,7 +287,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _authorizationsRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new ExpressRouteAuthorization(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -305,7 +302,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _authorizationsRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new ExpressRouteAuthorization(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -328,7 +325,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _authorizationsRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new ExpressRouteAuthorization(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -343,7 +340,7 @@ async Task> NextPageFunc(string nextLink, int? p scope.Start(); try { - var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _authorizationsRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new ExpressRouteAuthorization(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -355,7 +352,22 @@ async Task> NextPageFunc(string nextLink, int? p return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + // Builders. - // public ArmBuilder Construct() { } + // public ArmBuilder Construct() { } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs index 255fe42f59ef..cd77338e73a0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ExpressRouteAuthorizationData.cs @@ -5,7 +5,7 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs index b285d4e8ff2c..87e1666c1d03 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/ArmClientExtensions.cs @@ -5,6 +5,7 @@ #nullable disable +using Azure.Core; using Azure.ResourceManager; namespace Azure.ResourceManager.Avs @@ -19,6 +20,7 @@ public static partial class ArmClientExtensions /// Returns a object. public static PrivateCloud GetPrivateCloud(this ArmClient armClient, ResourceIdentifier id) { + PrivateCloud.ValidateResourceId(id); return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new PrivateCloud(clientOptions, credential, uri, pipeline, id)); } #endregion @@ -30,6 +32,7 @@ public static PrivateCloud GetPrivateCloud(this ArmClient armClient, ResourceIde /// Returns a object. public static Cluster GetCluster(this ArmClient armClient, ResourceIdentifier id) { + Cluster.ValidateResourceId(id); return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new Cluster(clientOptions, credential, uri, pipeline, id)); } #endregion @@ -41,6 +44,7 @@ public static Cluster GetCluster(this ArmClient armClient, ResourceIdentifier id /// Returns a object. public static Datastore GetDatastore(this ArmClient armClient, ResourceIdentifier id) { + Datastore.ValidateResourceId(id); return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new Datastore(clientOptions, credential, uri, pipeline, id)); } #endregion @@ -52,6 +56,7 @@ public static Datastore GetDatastore(this ArmClient armClient, ResourceIdentifie /// Returns a object. public static HcxEnterpriseSite GetHcxEnterpriseSite(this ArmClient armClient, ResourceIdentifier id) { + HcxEnterpriseSite.ValidateResourceId(id); return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new HcxEnterpriseSite(clientOptions, credential, uri, pipeline, id)); } #endregion @@ -63,6 +68,7 @@ public static HcxEnterpriseSite GetHcxEnterpriseSite(this ArmClient armClient, R /// Returns a object. public static ExpressRouteAuthorization GetExpressRouteAuthorization(this ArmClient armClient, ResourceIdentifier id) { + ExpressRouteAuthorization.ValidateResourceId(id); return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new ExpressRouteAuthorization(clientOptions, credential, uri, pipeline, id)); } #endregion @@ -74,10 +80,119 @@ public static ExpressRouteAuthorization GetExpressRouteAuthorization(this ArmCli /// Returns a object. public static GlobalReachConnection GetGlobalReachConnection(this ArmClient armClient, ResourceIdentifier id) { + GlobalReachConnection.ValidateResourceId(id); return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new GlobalReachConnection(clientOptions, credential, uri, pipeline, id)); } #endregion + #region WorkloadNetworkSegment + /// Gets an object representing a WorkloadNetworkSegment along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkloadNetworkSegment GetWorkloadNetworkSegment(this ArmClient armClient, ResourceIdentifier id) + { + WorkloadNetworkSegment.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkSegment(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region WorkloadNetworkDhcp + /// Gets an object representing a WorkloadNetworkDhcp along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkloadNetworkDhcp GetWorkloadNetworkDhcp(this ArmClient armClient, ResourceIdentifier id) + { + WorkloadNetworkDhcp.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkDhcp(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region WorkloadNetworkGateway + /// Gets an object representing a WorkloadNetworkGateway along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkloadNetworkGateway GetWorkloadNetworkGateway(this ArmClient armClient, ResourceIdentifier id) + { + WorkloadNetworkGateway.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkGateway(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region WorkloadNetworkPortMirroring + /// Gets an object representing a WorkloadNetworkPortMirroring along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkloadNetworkPortMirroring GetWorkloadNetworkPortMirroring(this ArmClient armClient, ResourceIdentifier id) + { + WorkloadNetworkPortMirroring.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkPortMirroring(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region WorkloadNetworkVMGroup + /// Gets an object representing a WorkloadNetworkVMGroup along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkloadNetworkVMGroup GetWorkloadNetworkVMGroup(this ArmClient armClient, ResourceIdentifier id) + { + WorkloadNetworkVMGroup.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkVMGroup(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region WorkloadNetworkVirtualMachine + /// Gets an object representing a WorkloadNetworkVirtualMachine along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkloadNetworkVirtualMachine GetWorkloadNetworkVirtualMachine(this ArmClient armClient, ResourceIdentifier id) + { + WorkloadNetworkVirtualMachine.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkVirtualMachine(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region WorkloadNetworkDnsService + /// Gets an object representing a WorkloadNetworkDnsService along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkloadNetworkDnsService GetWorkloadNetworkDnsService(this ArmClient armClient, ResourceIdentifier id) + { + WorkloadNetworkDnsService.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkDnsService(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region WorkloadNetworkDnsZone + /// Gets an object representing a WorkloadNetworkDnsZone along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkloadNetworkDnsZone GetWorkloadNetworkDnsZone(this ArmClient armClient, ResourceIdentifier id) + { + WorkloadNetworkDnsZone.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkDnsZone(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region WorkloadNetworkPublicIP + /// Gets an object representing a WorkloadNetworkPublicIP along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static WorkloadNetworkPublicIP GetWorkloadNetworkPublicIP(this ArmClient armClient, ResourceIdentifier id) + { + WorkloadNetworkPublicIP.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new WorkloadNetworkPublicIP(clientOptions, credential, uri, pipeline, id)); + } + #endregion + #region CloudLink /// Gets an object representing a CloudLink along with the instance operations that can be performed on it but with no data. /// The instance the method will execute against. @@ -85,6 +200,7 @@ public static GlobalReachConnection GetGlobalReachConnection(this ArmClient armC /// Returns a object. public static CloudLink GetCloudLink(this ArmClient armClient, ResourceIdentifier id) { + CloudLink.ValidateResourceId(id); return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new CloudLink(clientOptions, credential, uri, pipeline, id)); } #endregion @@ -96,10 +212,23 @@ public static CloudLink GetCloudLink(this ArmClient armClient, ResourceIdentifie /// Returns a object. public static Addon GetAddon(this ArmClient armClient, ResourceIdentifier id) { + Addon.ValidateResourceId(id); return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new Addon(clientOptions, credential, uri, pipeline, id)); } #endregion + #region VirtualMachine + /// Gets an object representing a VirtualMachine along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static VirtualMachine GetVirtualMachine(this ArmClient armClient, ResourceIdentifier id) + { + VirtualMachine.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new VirtualMachine(clientOptions, credential, uri, pipeline, id)); + } + #endregion + #region PlacementPolicy /// Gets an object representing a PlacementPolicy along with the instance operations that can be performed on it but with no data. /// The instance the method will execute against. @@ -107,8 +236,45 @@ public static Addon GetAddon(this ArmClient armClient, ResourceIdentifier id) /// Returns a object. public static PlacementPolicy GetPlacementPolicy(this ArmClient armClient, ResourceIdentifier id) { + PlacementPolicy.ValidateResourceId(id); return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new PlacementPolicy(clientOptions, credential, uri, pipeline, id)); } #endregion + + #region ScriptPackage + /// Gets an object representing a ScriptPackage along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ScriptPackage GetScriptPackage(this ArmClient armClient, ResourceIdentifier id) + { + ScriptPackage.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new ScriptPackage(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region ScriptCmdlet + /// Gets an object representing a ScriptCmdlet along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ScriptCmdlet GetScriptCmdlet(this ArmClient armClient, ResourceIdentifier id) + { + ScriptCmdlet.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new ScriptCmdlet(clientOptions, credential, uri, pipeline, id)); + } + #endregion + + #region ScriptExecution + /// Gets an object representing a ScriptExecution along with the instance operations that can be performed on it but with no data. + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ScriptExecution GetScriptExecution(this ArmClient armClient, ResourceIdentifier id) + { + ScriptExecution.ValidateResourceId(id); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new ScriptExecution(clientOptions, credential, uri, pipeline, id)); + } + #endregion } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionExtensions.cs index 9204e557f648..4ca53514d90e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionExtensions.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/SubscriptionExtensions.cs @@ -22,135 +22,14 @@ namespace Azure.ResourceManager.Avs /// A class to add extension methods to Subscription. public static partial class SubscriptionExtensions { - #region PrivateCloud - private static PrivateCloudsRestOperations GetPrivateCloudsRestOperations(ClientDiagnostics clientDiagnostics, TokenCredential credential, ArmClientOptions clientOptions, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + private static LocationsRestOperations GetLocationsRestOperations(ClientDiagnostics clientDiagnostics, TokenCredential credential, ArmClientOptions clientOptions, HttpPipeline pipeline, Uri endpoint = null) { - return new PrivateCloudsRestOperations(clientDiagnostics, pipeline, clientOptions, subscriptionId, endpoint); + return new LocationsRestOperations(clientDiagnostics, pipeline, clientOptions, endpoint); } - /// Lists the PrivateClouds for this . - /// The instance the method will execute against. - /// The cancellation token to use. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable GetPrivateCloudsAsync(this Subscription subscription, CancellationToken cancellationToken = default) - { - return subscription.UseClientContext((baseUri, credential, options, pipeline) => - { - var clientDiagnostics = new ClientDiagnostics(options); - var restOperations = GetPrivateCloudsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetPrivateClouds"); - scope.Start(); - try - { - var response = await restOperations.GetInSubscriptionAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetPrivateClouds"); - scope.Start(); - try - { - var response = await restOperations.GetInSubscriptionNextPageAsync(nextLink, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - ); - } - - /// Lists the PrivateClouds for this . - /// The instance the method will execute against. - /// The cancellation token to use. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable GetPrivateClouds(this Subscription subscription, CancellationToken cancellationToken = default) - { - return subscription.UseClientContext((baseUri, credential, options, pipeline) => - { - var clientDiagnostics = new ClientDiagnostics(options); - var restOperations = GetPrivateCloudsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetPrivateClouds"); - scope.Start(); - try - { - var response = restOperations.GetInSubscription(cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetPrivateClouds"); - scope.Start(); - try - { - var response = restOperations.GetInSubscriptionNextPage(nextLink, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - ); - } - - /// Filters the list of PrivateClouds for a represented as generic resources. - /// The instance the method will execute against. - /// The string to filter the list. - /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. - /// The number of results to return. - /// The cancellation token to use. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static AsyncPageable GetPrivateCloudByNameAsync(this Subscription subscription, string filter, string expand, int? top, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new(PrivateCloud.ResourceType); - filters.SubstringFilter = filter; - return ResourceListOperations.GetAtContextAsync(subscription, filters, expand, top, cancellationToken); - } - - /// Filters the list of PrivateClouds for a represented as generic resources. - /// The instance the method will execute against. - /// The string to filter the list. - /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. - /// The number of results to return. - /// The cancellation token to use. - /// A collection of resource operations that may take multiple service requests to iterate over. - public static Pageable GetPrivateCloudByName(this Subscription subscription, string filter, string expand, int? top, CancellationToken cancellationToken = default) - { - ResourceFilterCollection filters = new(PrivateCloud.ResourceType); - filters.SubstringFilter = filter; - return ResourceListOperations.GetAtContext(subscription, filters, expand, top, cancellationToken); - } - #endregion - - #region Location - private static LocationsRestOperations GetLocationsRestOperations(ClientDiagnostics clientDiagnostics, TokenCredential credential, ArmClientOptions clientOptions, HttpPipeline pipeline, string subscriptionId, Uri endpoint = null) + private static PrivateCloudsRestOperations GetPrivateCloudsRestOperations(ClientDiagnostics clientDiagnostics, TokenCredential credential, ArmClientOptions clientOptions, HttpPipeline pipeline, Uri endpoint = null) { - return new LocationsRestOperations(clientDiagnostics, pipeline, clientOptions, subscriptionId, endpoint); + return new PrivateCloudsRestOperations(clientDiagnostics, pipeline, clientOptions, endpoint); } /// Return trial status for subscription by region. @@ -158,7 +37,7 @@ private static LocationsRestOperations GetLocationsRestOperations(ClientDiagnost /// Azure region. /// The cancellation token to use. /// is null. - public static async Task> CheckLocationTrialAvailabilityAsync(this Subscription subscription, string location, CancellationToken cancellationToken = default) + public static async Task> CheckTrialAvailabilityLocationAsync(this Subscription subscription, string location, CancellationToken cancellationToken = default) { if (location == null) { @@ -168,12 +47,12 @@ public static async Task> CheckLocationTrialAvailabilityAsync(th return await subscription.UseClientContext(async (baseUri, credential, options, pipeline) => { var clientDiagnostics = new ClientDiagnostics(options); - var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); - using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckLocationTrialAvailability"); + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckTrialAvailabilityLocation"); scope.Start(); try { - var response = await restOperations.CheckTrialAvailabilityAsync(location, cancellationToken).ConfigureAwait(false); + var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, baseUri); + var response = await restOperations.CheckTrialAvailabilityAsync(subscription.Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -190,7 +69,7 @@ public static async Task> CheckLocationTrialAvailabilityAsync(th /// Azure region. /// The cancellation token to use. /// is null. - public static Response CheckLocationTrialAvailability(this Subscription subscription, string location, CancellationToken cancellationToken = default) + public static Response CheckTrialAvailabilityLocation(this Subscription subscription, string location, CancellationToken cancellationToken = default) { if (location == null) { @@ -200,12 +79,12 @@ public static Response CheckLocationTrialAvailability(this Subscription s return subscription.UseClientContext((baseUri, credential, options, pipeline) => { var clientDiagnostics = new ClientDiagnostics(options); - var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); - using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckLocationTrialAvailability"); + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckTrialAvailabilityLocation"); scope.Start(); try { - var response = restOperations.CheckTrialAvailability(location, cancellationToken); + var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, baseUri); + var response = restOperations.CheckTrialAvailability(subscription.Id.SubscriptionId, location, cancellationToken); return response; } catch (Exception e) @@ -222,7 +101,7 @@ public static Response CheckLocationTrialAvailability(this Subscription s /// Azure region. /// The cancellation token to use. /// is null. - public static async Task> CheckLocationQuotaAvailabilityAsync(this Subscription subscription, string location, CancellationToken cancellationToken = default) + public static async Task> CheckQuotaAvailabilityLocationAsync(this Subscription subscription, string location, CancellationToken cancellationToken = default) { if (location == null) { @@ -232,12 +111,12 @@ public static async Task> CheckLocationQuotaAvailabilityAsync(th return await subscription.UseClientContext(async (baseUri, credential, options, pipeline) => { var clientDiagnostics = new ClientDiagnostics(options); - var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); - using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckLocationQuotaAvailability"); + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckQuotaAvailabilityLocation"); scope.Start(); try { - var response = await restOperations.CheckQuotaAvailabilityAsync(location, cancellationToken).ConfigureAwait(false); + var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, baseUri); + var response = await restOperations.CheckQuotaAvailabilityAsync(subscription.Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -254,7 +133,7 @@ public static async Task> CheckLocationQuotaAvailabilityAsync(th /// Azure region. /// The cancellation token to use. /// is null. - public static Response CheckLocationQuotaAvailability(this Subscription subscription, string location, CancellationToken cancellationToken = default) + public static Response CheckQuotaAvailabilityLocation(this Subscription subscription, string location, CancellationToken cancellationToken = default) { if (location == null) { @@ -264,12 +143,12 @@ public static Response CheckLocationQuotaAvailability(this Subscription s return subscription.UseClientContext((baseUri, credential, options, pipeline) => { var clientDiagnostics = new ClientDiagnostics(options); - var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, subscription.Id.SubscriptionId, baseUri); - using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckLocationQuotaAvailability"); + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.CheckQuotaAvailabilityLocation"); scope.Start(); try { - var response = restOperations.CheckQuotaAvailability(location, cancellationToken); + var restOperations = GetLocationsRestOperations(clientDiagnostics, credential, options, pipeline, baseUri); + var response = restOperations.CheckQuotaAvailability(subscription.Id.SubscriptionId, location, cancellationToken); return response; } catch (Exception e) @@ -281,6 +160,122 @@ public static Response CheckLocationQuotaAvailability(this Subscription s ); } - #endregion + /// Lists the PrivateClouds for this . + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static AsyncPageable GetInSubscriptionPrivateCloudsAsync(this Subscription subscription, CancellationToken cancellationToken = default) + { + return subscription.UseClientContext((baseUri, credential, options, pipeline) => + { + var clientDiagnostics = new ClientDiagnostics(options); + var restOperations = GetPrivateCloudsRestOperations(clientDiagnostics, credential, options, pipeline, baseUri); + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetInSubscriptionPrivateClouds"); + scope.Start(); + try + { + var response = await restOperations.ListInSubscriptionAsync(subscription.Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetInSubscriptionPrivateClouds"); + scope.Start(); + try + { + var response = await restOperations.ListInSubscriptionNextPageAsync(nextLink, subscription.Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + ); + } + + /// Lists the PrivateClouds for this . + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static Pageable GetInSubscriptionPrivateClouds(this Subscription subscription, CancellationToken cancellationToken = default) + { + return subscription.UseClientContext((baseUri, credential, options, pipeline) => + { + var clientDiagnostics = new ClientDiagnostics(options); + var restOperations = GetPrivateCloudsRestOperations(clientDiagnostics, credential, options, pipeline, baseUri); + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetInSubscriptionPrivateClouds"); + scope.Start(); + try + { + var response = restOperations.ListInSubscription(subscription.Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = clientDiagnostics.CreateScope("SubscriptionExtensions.GetInSubscriptionPrivateClouds"); + scope.Start(); + try + { + var response = restOperations.ListInSubscriptionNextPage(nextLink, subscription.Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(subscription, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + ); + } + + /// Filters the list of PrivateClouds for a represented as generic resources. + /// The instance the method will execute against. + /// The string to filter the list. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. + /// The number of results to return. + /// The cancellation token to use. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static AsyncPageable GetPrivateCloudsAsGenericResourcesAsync(this Subscription subscription, string filter, string expand, int? top, CancellationToken cancellationToken = default) + { + ResourceFilterCollection filters = new(PrivateCloud.ResourceType); + filters.SubstringFilter = filter; + return ResourceListOperations.GetAtContextAsync(subscription, filters, expand, top, cancellationToken); + } + + /// Filters the list of PrivateClouds for a represented as generic resources. + /// The instance the method will execute against. + /// The string to filter the list. + /// Comma-separated list of additional properties to be included in the response. Valid values include `createdTime`, `changedTime` and `provisioningState`. + /// The number of results to return. + /// The cancellation token to use. + /// A collection of resource operations that may take multiple service requests to iterate over. + public static Pageable GetPrivateCloudsAsGenericResources(this Subscription subscription, string filter, string expand, int? top, CancellationToken cancellationToken = default) + { + ResourceFilterCollection filters = new(PrivateCloud.ResourceType); + filters.SubstringFilter = filter; + return ResourceListOperations.GetAtContext(subscription, filters, expand, top, cancellationToken); + } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnection.cs index 9c9752ba2e63..acc1bfcbf39d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnection.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using Azure; @@ -15,15 +16,20 @@ using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { /// A Class representing a GlobalReachConnection along with the instance operations that can be performed on it. public partial class GlobalReachConnection : ArmResource { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"; + return new ResourceIdentifier(resourceId); + } private readonly ClientDiagnostics _clientDiagnostics; - private readonly GlobalReachConnectionsRestOperations _restClient; + private readonly GlobalReachConnectionsRestOperations _globalReachConnectionsRestClient; private readonly GlobalReachConnectionData _data; /// Initializes a new instance of the class for mocking. @@ -33,13 +39,16 @@ protected GlobalReachConnection() /// Initializes a new instance of the class. /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal GlobalReachConnection(ArmResource options, GlobalReachConnectionData resource) : base(options, resource.Id) + /// The resource that is the target of operations. + internal GlobalReachConnection(ArmResource options, GlobalReachConnectionData data) : base(options, data.Id) { HasData = true; - _data = resource; + _data = data; _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _globalReachConnectionsRestClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -48,7 +57,10 @@ internal GlobalReachConnection(ArmResource options, GlobalReachConnectionData re internal GlobalReachConnection(ArmResource options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _globalReachConnectionsRestClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -60,15 +72,15 @@ internal GlobalReachConnection(ArmResource options, ResourceIdentifier id) : bas internal GlobalReachConnection(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _globalReachConnectionsRestClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/globalReachConnections"; - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - /// Gets whether or not the current instance has data. public virtual bool HasData { get; } @@ -84,6 +96,12 @@ public virtual GlobalReachConnectionData Data } } + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + /// Get a global reach connection by name in a private cloud. /// The cancellation token to use. public async virtual Task> GetAsync(CancellationToken cancellationToken = default) @@ -92,7 +110,7 @@ public async virtual Task> GetAsync(Cancellation scope.Start(); try { - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _globalReachConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new GlobalReachConnection(this, response.Value), response.GetRawResponse()); @@ -112,7 +130,7 @@ public virtual Response Get(CancellationToken cancellatio scope.Start(); try { - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _globalReachConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new GlobalReachConnection(this, response.Value), response.GetRawResponse()); @@ -127,30 +145,50 @@ public virtual Response Get(CancellationToken cancellatio /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnection.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) { - return ListAvailableLocations(ResourceType, cancellationToken); + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnection.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Delete a global reach connection in a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("GlobalReachConnection.Delete"); scope.Start(); try { - var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new GlobalReachConnectionDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + var response = await _globalReachConnectionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new GlobalReachConnectionDeleteOperation(_clientDiagnostics, Pipeline, _globalReachConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -165,14 +203,14 @@ public async virtual Task DeleteAsync(bool /// Delete a global reach connection in a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual GlobalReachConnectionDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual GlobalReachConnectionDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("GlobalReachConnection.Delete"); scope.Start(); try { - var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new GlobalReachConnectionDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + var response = _globalReachConnectionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new GlobalReachConnectionDeleteOperation(_clientDiagnostics, Pipeline, _globalReachConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs index 6f0fe6841108..0eac429dcefa 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionCollection.cs @@ -8,55 +8,46 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs { - /// A class representing collection of GlobalReachConnection and their operations over a PrivateCloud. + /// A class representing collection of GlobalReachConnection and their operations over its parent. public partial class GlobalReachConnectionCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _clientDiagnostics; - private readonly GlobalReachConnectionsRestOperations _restClient; + private readonly GlobalReachConnectionsRestOperations _globalReachConnectionsRestClient; /// Initializes a new instance of the class for mocking. protected GlobalReachConnectionCollection() { } - /// Initializes a new instance of GlobalReachConnectionCollection class. + /// Initializes a new instance of the class. /// The resource representing the parent resource. internal GlobalReachConnectionCollection(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _globalReachConnectionsRestClient = new GlobalReachConnectionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } - IEnumerator IEnumerable.GetEnumerator() + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetAll().GetEnumerator(); + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); } - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; - // Collection level operations. /// Create or update a global reach connection in a private cloud. @@ -65,7 +56,7 @@ IAsyncEnumerator IAsyncEnumerable. /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public virtual GlobalReachConnectionCreateOrUpdateOperation CreateOrUpdate(string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual GlobalReachConnectionCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, CancellationToken cancellationToken = default) { if (globalReachConnectionName == null) { @@ -80,8 +71,8 @@ public virtual GlobalReachConnectionCreateOrUpdateOperation CreateOrUpdate(strin scope.Start(); try { - var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection, cancellationToken); - var operation = new GlobalReachConnectionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection).Request, response); + var response = _globalReachConnectionsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection, cancellationToken); + var operation = new GlobalReachConnectionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _globalReachConnectionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -99,7 +90,7 @@ public virtual GlobalReachConnectionCreateOrUpdateOperation CreateOrUpdate(strin /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public async virtual Task CreateOrUpdateAsync(string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, CancellationToken cancellationToken = default) { if (globalReachConnectionName == null) { @@ -114,8 +105,8 @@ public async virtual Task CreateOr scope.Start(); try { - var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection, cancellationToken).ConfigureAwait(false); - var operation = new GlobalReachConnectionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection).Request, response); + var response = await _globalReachConnectionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection, cancellationToken).ConfigureAwait(false); + var operation = new GlobalReachConnectionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _globalReachConnectionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalReachConnectionName, globalReachConnection).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -127,21 +118,22 @@ public async virtual Task CreateOr } } - /// Gets details for this resource from the service. + /// Get a global reach connection by name in a private cloud. /// Name of the global reach connection in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response Get(string globalReachConnectionName, CancellationToken cancellationToken = default) { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.Get"); scope.Start(); try { - if (globalReachConnectionName == null) - { - throw new ArgumentNullException(nameof(globalReachConnectionName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken); + var response = _globalReachConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new GlobalReachConnection(Parent, response.Value), response.GetRawResponse()); @@ -153,21 +145,22 @@ public virtual Response Get(string globalReachConnectionN } } - /// Gets details for this resource from the service. + /// Get a global reach connection by name in a private cloud. /// Name of the global reach connection in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetAsync(string globalReachConnectionName, CancellationToken cancellationToken = default) { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.Get"); scope.Start(); try { - if (globalReachConnectionName == null) - { - throw new ArgumentNullException(nameof(globalReachConnectionName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _globalReachConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new GlobalReachConnection(Parent, response.Value), response.GetRawResponse()); @@ -181,22 +174,23 @@ public async virtual Task> GetAsync(string globa /// Tries to get details for this resource from the service. /// Name of the global reach connection in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response GetIfExists(string globalReachConnectionName, CancellationToken cancellationToken = default) { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.GetIfExists"); scope.Start(); try { - if (globalReachConnectionName == null) - { - throw new ArgumentNullException(nameof(globalReachConnectionName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new GlobalReachConnection(this, response.Value), response.GetRawResponse()); + var response = _globalReachConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new GlobalReachConnection(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,22 +201,23 @@ public virtual Response GetIfExists(string globalReachCon /// Tries to get details for this resource from the service. /// Name of the global reach connection in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetIfExistsAsync(string globalReachConnectionName, CancellationToken cancellationToken = default) { + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.GetIfExists"); scope.Start(); try { - if (globalReachConnectionName == null) - { - throw new ArgumentNullException(nameof(globalReachConnectionName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new GlobalReachConnection(this, response.Value), response.GetRawResponse()); + var response = await _globalReachConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, globalReachConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new GlobalReachConnection(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -233,18 +228,19 @@ public async virtual Task> GetIfExistsAsync(stri /// Tries to get details for this resource from the service. /// Name of the global reach connection in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string globalReachConnectionName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string globalReachConnectionName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.CheckIfExists"); + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.Exists"); scope.Start(); try { - if (globalReachConnectionName == null) - { - throw new ArgumentNullException(nameof(globalReachConnectionName)); - } - var response = GetIfExists(globalReachConnectionName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -257,18 +253,19 @@ public virtual Response CheckIfExists(string globalReachConnectionName, Ca /// Tries to get details for this resource from the service. /// Name of the global reach connection in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string globalReachConnectionName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string globalReachConnectionName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.CheckIfExists"); + if (globalReachConnectionName == null) + { + throw new ArgumentNullException(nameof(globalReachConnectionName)); + } + + using var scope = _clientDiagnostics.CreateScope("GlobalReachConnectionCollection.Exists"); scope.Start(); try { - if (globalReachConnectionName == null) - { - throw new ArgumentNullException(nameof(globalReachConnectionName)); - } - var response = await GetIfExistsAsync(globalReachConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -290,7 +287,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _globalReachConnectionsRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new GlobalReachConnection(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -305,7 +302,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _globalReachConnectionsRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new GlobalReachConnection(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -328,7 +325,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _globalReachConnectionsRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new GlobalReachConnection(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -343,7 +340,7 @@ async Task> NextPageFunc(string nextLink, int? pageS scope.Start(); try { - var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _globalReachConnectionsRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new GlobalReachConnection(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -355,7 +352,22 @@ async Task> NextPageFunc(string nextLink, int? pageS return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + // Builders. - // public ArmBuilder Construct() { } + // public ArmBuilder Construct() { } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs index cb44de722432..f2d6f25e812c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/GlobalReachConnectionData.cs @@ -5,7 +5,7 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSite.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSite.cs index e63fc9af281e..070028ce352c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSite.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSite.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using Azure; @@ -15,15 +16,20 @@ using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { /// A Class representing a HcxEnterpriseSite along with the instance operations that can be performed on it. public partial class HcxEnterpriseSite : ArmResource { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"; + return new ResourceIdentifier(resourceId); + } private readonly ClientDiagnostics _clientDiagnostics; - private readonly HcxEnterpriseSitesRestOperations _restClient; + private readonly HcxEnterpriseSitesRestOperations _hcxEnterpriseSitesRestClient; private readonly HcxEnterpriseSiteData _data; /// Initializes a new instance of the class for mocking. @@ -33,13 +39,16 @@ protected HcxEnterpriseSite() /// Initializes a new instance of the class. /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal HcxEnterpriseSite(ArmResource options, HcxEnterpriseSiteData resource) : base(options, resource.Id) + /// The resource that is the target of operations. + internal HcxEnterpriseSite(ArmResource options, HcxEnterpriseSiteData data) : base(options, data.Id) { HasData = true; - _data = resource; + _data = data; _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _hcxEnterpriseSitesRestClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -48,7 +57,10 @@ internal HcxEnterpriseSite(ArmResource options, HcxEnterpriseSiteData resource) internal HcxEnterpriseSite(ArmResource options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _hcxEnterpriseSitesRestClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -60,15 +72,15 @@ internal HcxEnterpriseSite(ArmResource options, ResourceIdentifier id) : base(op internal HcxEnterpriseSite(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _hcxEnterpriseSitesRestClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/hcxEnterpriseSites"; - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - /// Gets whether or not the current instance has data. public virtual bool HasData { get; } @@ -84,6 +96,12 @@ public virtual HcxEnterpriseSiteData Data } } + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + /// Get an HCX Enterprise Site by name in a private cloud. /// The cancellation token to use. public async virtual Task> GetAsync(CancellationToken cancellationToken = default) @@ -92,7 +110,7 @@ public async virtual Task> GetAsync(CancellationToke scope.Start(); try { - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _hcxEnterpriseSitesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new HcxEnterpriseSite(this, response.Value), response.GetRawResponse()); @@ -112,7 +130,7 @@ public virtual Response Get(CancellationToken cancellationTok scope.Start(); try { - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _hcxEnterpriseSitesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new HcxEnterpriseSite(this, response.Value), response.GetRawResponse()); @@ -127,29 +145,49 @@ public virtual Response Get(CancellationToken cancellationTok /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSite.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) { - return ListAvailableLocations(ResourceType, cancellationToken); + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSite.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Delete an HCX Enterprise Site in a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSite.Delete"); scope.Start(); try { - var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _hcxEnterpriseSitesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); var operation = new HcxEnterpriseSiteDeleteOperation(response); if (waitForCompletion) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -165,13 +203,13 @@ public async virtual Task DeleteAsync(bool wai /// Delete an HCX Enterprise Site in a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual HcxEnterpriseSiteDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual HcxEnterpriseSiteDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSite.Delete"); scope.Start(); try { - var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _hcxEnterpriseSitesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); var operation = new HcxEnterpriseSiteDeleteOperation(response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs index 30ebffeb49b1..9998f951516b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteCollection.cs @@ -8,55 +8,46 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs { - /// A class representing collection of HcxEnterpriseSite and their operations over a PrivateCloud. + /// A class representing collection of HcxEnterpriseSite and their operations over its parent. public partial class HcxEnterpriseSiteCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _clientDiagnostics; - private readonly HcxEnterpriseSitesRestOperations _restClient; + private readonly HcxEnterpriseSitesRestOperations _hcxEnterpriseSitesRestClient; /// Initializes a new instance of the class for mocking. protected HcxEnterpriseSiteCollection() { } - /// Initializes a new instance of HcxEnterpriseSiteCollection class. + /// Initializes a new instance of the class. /// The resource representing the parent resource. internal HcxEnterpriseSiteCollection(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _hcxEnterpriseSitesRestClient = new HcxEnterpriseSitesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } - IEnumerator IEnumerable.GetEnumerator() + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetAll().GetEnumerator(); + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); } - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => PrivateCloud.ResourceType; - // Collection level operations. /// Create or update an HCX Enterprise Site in a private cloud. @@ -65,7 +56,7 @@ IAsyncEnumerator IAsyncEnumerable.GetAsync /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public virtual HcxEnterpriseSiteCreateOrUpdateOperation CreateOrUpdate(string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual HcxEnterpriseSiteCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, CancellationToken cancellationToken = default) { if (hcxEnterpriseSiteName == null) { @@ -80,7 +71,7 @@ public virtual HcxEnterpriseSiteCreateOrUpdateOperation CreateOrUpdate(string hc scope.Start(); try { - var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, hcxEnterpriseSite, cancellationToken); + var response = _hcxEnterpriseSitesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, hcxEnterpriseSite, cancellationToken); var operation = new HcxEnterpriseSiteCreateOrUpdateOperation(Parent, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); @@ -99,7 +90,7 @@ public virtual HcxEnterpriseSiteCreateOrUpdateOperation CreateOrUpdate(string hc /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public async virtual Task CreateOrUpdateAsync(string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, CancellationToken cancellationToken = default) { if (hcxEnterpriseSiteName == null) { @@ -114,7 +105,7 @@ public async virtual Task CreateOrUpda scope.Start(); try { - var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, hcxEnterpriseSite, cancellationToken).ConfigureAwait(false); + var response = await _hcxEnterpriseSitesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, hcxEnterpriseSite, cancellationToken).ConfigureAwait(false); var operation = new HcxEnterpriseSiteCreateOrUpdateOperation(Parent, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); @@ -127,21 +118,22 @@ public async virtual Task CreateOrUpda } } - /// Gets details for this resource from the service. + /// Get an HCX Enterprise Site by name in a private cloud. /// Name of the HCX Enterprise Site in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response Get(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.Get"); scope.Start(); try { - if (hcxEnterpriseSiteName == null) - { - throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken); + var response = _hcxEnterpriseSitesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new HcxEnterpriseSite(Parent, response.Value), response.GetRawResponse()); @@ -153,21 +145,22 @@ public virtual Response Get(string hcxEnterpriseSiteName, Can } } - /// Gets details for this resource from the service. + /// Get an HCX Enterprise Site by name in a private cloud. /// Name of the HCX Enterprise Site in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetAsync(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.Get"); scope.Start(); try { - if (hcxEnterpriseSiteName == null) - { - throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _hcxEnterpriseSitesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new HcxEnterpriseSite(Parent, response.Value), response.GetRawResponse()); @@ -181,22 +174,23 @@ public async virtual Task> GetAsync(string hcxEnterp /// Tries to get details for this resource from the service. /// Name of the HCX Enterprise Site in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response GetIfExists(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.GetIfExists"); scope.Start(); try { - if (hcxEnterpriseSiteName == null) - { - throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new HcxEnterpriseSite(this, response.Value), response.GetRawResponse()); + var response = _hcxEnterpriseSitesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new HcxEnterpriseSite(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,22 +201,23 @@ public virtual Response GetIfExists(string hcxEnterpriseSiteN /// Tries to get details for this resource from the service. /// Name of the HCX Enterprise Site in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetIfExistsAsync(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.GetIfExists"); scope.Start(); try { - if (hcxEnterpriseSiteName == null) - { - throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new HcxEnterpriseSite(this, response.Value), response.GetRawResponse()); + var response = await _hcxEnterpriseSitesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, hcxEnterpriseSiteName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new HcxEnterpriseSite(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -233,18 +228,19 @@ public async virtual Task> GetIfExistsAsync(string h /// Tries to get details for this resource from the service. /// Name of the HCX Enterprise Site in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.CheckIfExists"); + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.Exists"); scope.Start(); try { - if (hcxEnterpriseSiteName == null) - { - throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); - } - var response = GetIfExists(hcxEnterpriseSiteName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -257,18 +253,19 @@ public virtual Response CheckIfExists(string hcxEnterpriseSiteName, Cancel /// Tries to get details for this resource from the service. /// Name of the HCX Enterprise Site in the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.CheckIfExists"); + if (hcxEnterpriseSiteName == null) + { + throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); + } + + using var scope = _clientDiagnostics.CreateScope("HcxEnterpriseSiteCollection.Exists"); scope.Start(); try { - if (hcxEnterpriseSiteName == null) - { - throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); - } - var response = await GetIfExistsAsync(hcxEnterpriseSiteName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -290,7 +287,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _hcxEnterpriseSitesRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new HcxEnterpriseSite(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -305,7 +302,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + var response = _hcxEnterpriseSitesRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new HcxEnterpriseSite(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -328,7 +325,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _hcxEnterpriseSitesRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new HcxEnterpriseSite(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -343,7 +340,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeH scope.Start(); try { - var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _hcxEnterpriseSitesRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new HcxEnterpriseSite(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -355,7 +352,22 @@ async Task> NextPageFunc(string nextLink, int? pageSizeH return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + // Builders. - // public ArmBuilder Construct() { } + // public ArmBuilder Construct() { } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs index cfa1a42bd07b..a4b99ffbdac0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/HcxEnterpriseSiteData.cs @@ -5,7 +5,7 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonCreateOrUpdateOperation.cs index 14e7752e52af..16521d5b616c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonCreateOrUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AddonCreateOrUpdateOperation.cs @@ -65,13 +65,15 @@ internal AddonCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnost Addon IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new Addon(_operationBase, AddonData.DeserializeAddonData(document.RootElement)); + var data = AddonData.DeserializeAddonData(document.RootElement); + return new Addon(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new Addon(_operationBase, AddonData.DeserializeAddonData(document.RootElement)); + var data = AddonData.DeserializeAddonData(document.RootElement); + return new Addon(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationCreateOrUpdateOperation.cs index ce2fc6330a0e..919abaf18853 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationCreateOrUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/AuthorizationCreateOrUpdateOperation.cs @@ -65,13 +65,15 @@ internal AuthorizationCreateOrUpdateOperation(ArmResource operationsBase, Client ExpressRouteAuthorization IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new ExpressRouteAuthorization(_operationBase, ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(document.RootElement)); + var data = ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(document.RootElement); + return new ExpressRouteAuthorization(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new ExpressRouteAuthorization(_operationBase, ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(document.RootElement)); + var data = ExpressRouteAuthorizationData.DeserializeExpressRouteAuthorizationData(document.RootElement); + return new ExpressRouteAuthorization(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkCreateOrUpdateOperation.cs index e91bc96e108f..58f39cae3970 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkCreateOrUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/CloudLinkCreateOrUpdateOperation.cs @@ -65,13 +65,15 @@ internal CloudLinkCreateOrUpdateOperation(ArmResource operationsBase, ClientDiag CloudLink IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new CloudLink(_operationBase, CloudLinkData.DeserializeCloudLinkData(document.RootElement)); + var data = CloudLinkData.DeserializeCloudLinkData(document.RootElement); + return new CloudLink(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new CloudLink(_operationBase, CloudLinkData.DeserializeCloudLinkData(document.RootElement)); + var data = CloudLinkData.DeserializeCloudLinkData(document.RootElement); + return new CloudLink(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterCreateOrUpdateOperation.cs index c048ff7e54f1..23d9fe770613 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterCreateOrUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterCreateOrUpdateOperation.cs @@ -65,13 +65,15 @@ internal ClusterCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagno Cluster IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new Cluster(_operationBase, ClusterData.DeserializeClusterData(document.RootElement)); + var data = ClusterData.DeserializeClusterData(document.RootElement); + return new Cluster(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new Cluster(_operationBase, ClusterData.DeserializeClusterData(document.RootElement)); + var data = ClusterData.DeserializeClusterData(document.RootElement); + return new Cluster(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterUpdateOperation.cs index a751b9b677cb..b401c22cbd8a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ClusterUpdateOperation.cs @@ -65,13 +65,15 @@ internal ClusterUpdateOperation(ArmResource operationsBase, ClientDiagnostics cl Cluster IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new Cluster(_operationBase, ClusterData.DeserializeClusterData(document.RootElement)); + var data = ClusterData.DeserializeClusterData(document.RootElement); + return new Cluster(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new Cluster(_operationBase, ClusterData.DeserializeClusterData(document.RootElement)); + var data = ClusterData.DeserializeClusterData(document.RootElement); + return new Cluster(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreCreateOrUpdateOperation.cs index cea585c6868b..6d10a57fdc3a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreCreateOrUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/DatastoreCreateOrUpdateOperation.cs @@ -65,13 +65,15 @@ internal DatastoreCreateOrUpdateOperation(ArmResource operationsBase, ClientDiag Datastore IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new Datastore(_operationBase, DatastoreData.DeserializeDatastoreData(document.RootElement)); + var data = DatastoreData.DeserializeDatastoreData(document.RootElement); + return new Datastore(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new Datastore(_operationBase, DatastoreData.DeserializeDatastoreData(document.RootElement)); + var data = DatastoreData.DeserializeDatastoreData(document.RootElement); + return new Datastore(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionCreateOrUpdateOperation.cs index dfe4f8c47401..de126b1b9ba5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionCreateOrUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/GlobalReachConnectionCreateOrUpdateOperation.cs @@ -65,13 +65,15 @@ internal GlobalReachConnectionCreateOrUpdateOperation(ArmResource operationsBase GlobalReachConnection IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new GlobalReachConnection(_operationBase, GlobalReachConnectionData.DeserializeGlobalReachConnectionData(document.RootElement)); + var data = GlobalReachConnectionData.DeserializeGlobalReachConnectionData(document.RootElement); + return new GlobalReachConnection(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new GlobalReachConnection(_operationBase, GlobalReachConnectionData.DeserializeGlobalReachConnectionData(document.RootElement)); + var data = GlobalReachConnectionData.DeserializeGlobalReachConnectionData(document.RootElement); + return new GlobalReachConnection(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyCreateOrUpdateOperation.cs index 6bed6e39fd1c..dbb6b7fe71ca 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyCreateOrUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyCreateOrUpdateOperation.cs @@ -65,13 +65,15 @@ internal PlacementPolicyCreateOrUpdateOperation(ArmResource operationsBase, Clie PlacementPolicy IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new PlacementPolicy(_operationBase, PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement)); + var data = PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement); + return new PlacementPolicy(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new PlacementPolicy(_operationBase, PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement)); + var data = PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement); + return new PlacementPolicy(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyUpdateOperation.cs index f34a227c9089..1ea6c7070cae 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PlacementPolicyUpdateOperation.cs @@ -65,13 +65,15 @@ internal PlacementPolicyUpdateOperation(ArmResource operationsBase, ClientDiagno PlacementPolicy IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new PlacementPolicy(_operationBase, PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement)); + var data = PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement); + return new PlacementPolicy(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new PlacementPolicy(_operationBase, PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement)); + var data = PlacementPolicyData.DeserializePlacementPolicyData(document.RootElement); + return new PlacementPolicy(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudCreateOrUpdateOperation.cs index e38eb586d1c9..81fd6d15c26f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudCreateOrUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudCreateOrUpdateOperation.cs @@ -65,13 +65,15 @@ internal PrivateCloudCreateOrUpdateOperation(ArmResource operationsBase, ClientD PrivateCloud IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new PrivateCloud(_operationBase, PrivateCloudData.DeserializePrivateCloudData(document.RootElement)); + var data = PrivateCloudData.DeserializePrivateCloudData(document.RootElement); + return new PrivateCloud(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new PrivateCloud(_operationBase, PrivateCloudData.DeserializePrivateCloudData(document.RootElement)); + var data = PrivateCloudData.DeserializePrivateCloudData(document.RootElement); + return new PrivateCloud(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudUpdateOperation.cs index df738e73f08e..ce627432a871 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/PrivateCloudUpdateOperation.cs @@ -65,13 +65,15 @@ internal PrivateCloudUpdateOperation(ArmResource operationsBase, ClientDiagnosti PrivateCloud IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new PrivateCloud(_operationBase, PrivateCloudData.DeserializePrivateCloudData(document.RootElement)); + var data = PrivateCloudData.DeserializePrivateCloudData(document.RootElement); + return new PrivateCloud(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new PrivateCloud(_operationBase, PrivateCloudData.DeserializePrivateCloudData(document.RootElement)); + var data = PrivateCloudData.DeserializePrivateCloudData(document.RootElement); + return new PrivateCloud(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs index 9e70c8b6d0b3..7a4f29895d6a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/ScriptExecutionCreateOrUpdateOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class ScriptExecutionCreateOrUpdateOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of ScriptExecutionCreateOrUpdateOperation for mocking. protected ScriptExecutionCreateOrUpdateOperation() { } - internal ScriptExecutionCreateOrUpdateOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal ScriptExecutionCreateOrUpdateOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "ScriptExecutionCreateOrUpdateOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal ScriptExecutionCreateOrUpdateOperation(ClientDiagnostics clientDiagnost ScriptExecution IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return ScriptExecution.DeserializeScriptExecution(document.RootElement); + var data = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); + return new ScriptExecution(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return ScriptExecution.DeserializeScriptExecution(document.RootElement); + var data = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); + return new ScriptExecution(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDhcpOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDhcpOperation.cs index 74a379614d67..6fd3c9f5cb75 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDhcpOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDhcpOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkCreateDhcpOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkCreateDhcpOperation for mocking. protected WorkloadNetworkCreateDhcpOperation() { } - internal WorkloadNetworkCreateDhcpOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkCreateDhcpOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateDhcpOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkCreateDhcpOperation(ClientDiagnostics clientDiagnostics, WorkloadNetworkDhcp IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + var data = WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(document.RootElement); + return new WorkloadNetworkDhcp(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + var data = WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(document.RootElement); + return new WorkloadNetworkDhcp(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsServiceOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsServiceOperation.cs index cc1fa23dfcb7..b69a5b3a82f5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsServiceOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsServiceOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkCreateDnsServiceOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkCreateDnsServiceOperation for mocking. protected WorkloadNetworkCreateDnsServiceOperation() { } - internal WorkloadNetworkCreateDnsServiceOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkCreateDnsServiceOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateDnsServiceOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkCreateDnsServiceOperation(ClientDiagnostics clientDiagno WorkloadNetworkDnsService IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + var data = WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(document.RootElement); + return new WorkloadNetworkDnsService(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + var data = WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(document.RootElement); + return new WorkloadNetworkDnsService(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsZoneOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsZoneOperation.cs index aa4b144cd9f8..35598e5f3ad6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsZoneOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateDnsZoneOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkCreateDnsZoneOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkCreateDnsZoneOperation for mocking. protected WorkloadNetworkCreateDnsZoneOperation() { } - internal WorkloadNetworkCreateDnsZoneOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkCreateDnsZoneOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateDnsZoneOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkCreateDnsZoneOperation(ClientDiagnostics clientDiagnosti WorkloadNetworkDnsZone IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + var data = WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(document.RootElement); + return new WorkloadNetworkDnsZone(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + var data = WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(document.RootElement); + return new WorkloadNetworkDnsZone(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePortMirroringOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePortMirroringOperation.cs index 9212892cbdcc..aef0c1f48e5b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePortMirroringOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePortMirroringOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkCreatePortMirroringOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkCreatePortMirroringOperation for mocking. protected WorkloadNetworkCreatePortMirroringOperation() { } - internal WorkloadNetworkCreatePortMirroringOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkCreatePortMirroringOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreatePortMirroringOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkCreatePortMirroringOperation(ClientDiagnostics clientDia WorkloadNetworkPortMirroring IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + var data = WorkloadNetworkPortMirroringData.DeserializeWorkloadNetworkPortMirroringData(document.RootElement); + return new WorkloadNetworkPortMirroring(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + var data = WorkloadNetworkPortMirroringData.DeserializeWorkloadNetworkPortMirroringData(document.RootElement); + return new WorkloadNetworkPortMirroring(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePublicIPOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePublicIPOperation.cs index 1fe7d7b5d192..78d90df61f12 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePublicIPOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreatePublicIPOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkCreatePublicIPOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkCreatePublicIPOperation for mocking. protected WorkloadNetworkCreatePublicIPOperation() { } - internal WorkloadNetworkCreatePublicIPOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkCreatePublicIPOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreatePublicIPOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkCreatePublicIPOperation(ClientDiagnostics clientDiagnost WorkloadNetworkPublicIP IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); + var data = WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(document.RootElement); + return new WorkloadNetworkPublicIP(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); + var data = WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(document.RootElement); + return new WorkloadNetworkPublicIP(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs index f006548209cd..2521c79d1c95 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateSegmentsOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkCreateSegmentsOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkCreateSegmentsOperation for mocking. protected WorkloadNetworkCreateSegmentsOperation() { } - internal WorkloadNetworkCreateSegmentsOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkCreateSegmentsOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateSegmentsOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkCreateSegmentsOperation(ClientDiagnostics clientDiagnost WorkloadNetworkSegment IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); + var data = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); + return new WorkloadNetworkSegment(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); + var data = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); + return new WorkloadNetworkSegment(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateVMGroupOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateVMGroupOperation.cs index 614da0d892be..4dc97ca683f8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateVMGroupOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkCreateVMGroupOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkCreateVMGroupOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkCreateVMGroupOperation for mocking. protected WorkloadNetworkCreateVMGroupOperation() { } - internal WorkloadNetworkCreateVMGroupOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkCreateVMGroupOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkCreateVMGroupOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkCreateVMGroupOperation(ClientDiagnostics clientDiagnosti WorkloadNetworkVMGroup IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + var data = WorkloadNetworkVMGroupData.DeserializeWorkloadNetworkVMGroupData(document.RootElement); + return new WorkloadNetworkVMGroup(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + var data = WorkloadNetworkVMGroupData.DeserializeWorkloadNetworkVMGroupData(document.RootElement); + return new WorkloadNetworkVMGroup(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDhcpOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDhcpOperation.cs index 93a26ddfc45f..830caf854fb1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDhcpOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDhcpOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkUpdateDhcpOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkUpdateDhcpOperation for mocking. protected WorkloadNetworkUpdateDhcpOperation() { } - internal WorkloadNetworkUpdateDhcpOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkUpdateDhcpOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateDhcpOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkUpdateDhcpOperation(ClientDiagnostics clientDiagnostics, WorkloadNetworkDhcp IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + var data = WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(document.RootElement); + return new WorkloadNetworkDhcp(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + var data = WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(document.RootElement); + return new WorkloadNetworkDhcp(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsServiceOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsServiceOperation.cs index 3018cafe42ef..8c18db9be44f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsServiceOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsServiceOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkUpdateDnsServiceOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkUpdateDnsServiceOperation for mocking. protected WorkloadNetworkUpdateDnsServiceOperation() { } - internal WorkloadNetworkUpdateDnsServiceOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkUpdateDnsServiceOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateDnsServiceOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkUpdateDnsServiceOperation(ClientDiagnostics clientDiagno WorkloadNetworkDnsService IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + var data = WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(document.RootElement); + return new WorkloadNetworkDnsService(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + var data = WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(document.RootElement); + return new WorkloadNetworkDnsService(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsZoneOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsZoneOperation.cs index 5351052b8c3a..d5ccebe09fd7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsZoneOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateDnsZoneOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkUpdateDnsZoneOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkUpdateDnsZoneOperation for mocking. protected WorkloadNetworkUpdateDnsZoneOperation() { } - internal WorkloadNetworkUpdateDnsZoneOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkUpdateDnsZoneOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateDnsZoneOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkUpdateDnsZoneOperation(ClientDiagnostics clientDiagnosti WorkloadNetworkDnsZone IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + var data = WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(document.RootElement); + return new WorkloadNetworkDnsZone(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + var data = WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(document.RootElement); + return new WorkloadNetworkDnsZone(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdatePortMirroringOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdatePortMirroringOperation.cs index e74586b1c5e3..00df5db551c1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdatePortMirroringOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdatePortMirroringOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkUpdatePortMirroringOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkUpdatePortMirroringOperation for mocking. protected WorkloadNetworkUpdatePortMirroringOperation() { } - internal WorkloadNetworkUpdatePortMirroringOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkUpdatePortMirroringOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdatePortMirroringOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkUpdatePortMirroringOperation(ClientDiagnostics clientDia WorkloadNetworkPortMirroring IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + var data = WorkloadNetworkPortMirroringData.DeserializeWorkloadNetworkPortMirroringData(document.RootElement); + return new WorkloadNetworkPortMirroring(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + var data = WorkloadNetworkPortMirroringData.DeserializeWorkloadNetworkPortMirroringData(document.RootElement); + return new WorkloadNetworkPortMirroring(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs index 06fffa58a49d..96456b3dcfdc 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateSegmentsOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkUpdateSegmentsOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkUpdateSegmentsOperation for mocking. protected WorkloadNetworkUpdateSegmentsOperation() { } - internal WorkloadNetworkUpdateSegmentsOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkUpdateSegmentsOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateSegmentsOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkUpdateSegmentsOperation(ClientDiagnostics clientDiagnost WorkloadNetworkSegment IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); + var data = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); + return new WorkloadNetworkSegment(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); + var data = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); + return new WorkloadNetworkSegment(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateVMGroupOperation.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateVMGroupOperation.cs index a9a5506e1226..d6cad81b0f51 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateVMGroupOperation.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/LongRunningOperation/WorkloadNetworkUpdateVMGroupOperation.cs @@ -12,6 +12,8 @@ using Azure; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs; +using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs.Models { @@ -20,14 +22,17 @@ public partial class WorkloadNetworkUpdateVMGroupOperation : Operation _operation; + private readonly ArmResource _operationBase; + /// Initializes a new instance of WorkloadNetworkUpdateVMGroupOperation for mocking. protected WorkloadNetworkUpdateVMGroupOperation() { } - internal WorkloadNetworkUpdateVMGroupOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) + internal WorkloadNetworkUpdateVMGroupOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "WorkloadNetworkUpdateVMGroupOperation"); + _operationBase = operationsBase; } /// @@ -60,13 +65,15 @@ internal WorkloadNetworkUpdateVMGroupOperation(ClientDiagnostics clientDiagnosti WorkloadNetworkVMGroup IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + var data = WorkloadNetworkVMGroupData.DeserializeWorkloadNetworkVMGroupData(document.RootElement); + return new WorkloadNetworkVMGroup(_operationBase, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + var data = WorkloadNetworkVMGroupData.DeserializeWorkloadNetworkVMGroupData(document.RootElement); + return new WorkloadNetworkVMGroup(_operationBase, data); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonData.Serialization.cs index ee1db6668f07..4269a45ee380 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/AddonData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs @@ -45,7 +44,7 @@ internal static AddonData DeserializeAddonData(JsonElement element) } if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkData.Serialization.cs index b2dd2911a65b..53b1002f1085 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/CloudLinkData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs @@ -39,7 +38,7 @@ internal static CloudLinkData DeserializeCloudLinkData(JsonElement element) { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterData.Serialization.cs index 032d2f003091..a435daca9802 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ClusterData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs @@ -60,7 +59,7 @@ internal static ClusterData DeserializeClusterData(JsonElement element) } if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreData.Serialization.cs index 0807ab58a9f6..7eced7d2cadf 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/DatastoreData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Resources.Models; @@ -47,7 +46,7 @@ internal static DatastoreData DeserializeDatastoreData(JsonElement element) { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs index a717cc263ee4..718c0f3d9387 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ExpressRouteAuthorizationData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs @@ -41,7 +40,7 @@ internal static ExpressRouteAuthorizationData DeserializeExpressRouteAuthorizati { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs index dddbac1518ff..913b43e35740 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/GlobalReachConnectionData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs @@ -53,7 +52,7 @@ internal static GlobalReachConnectionData DeserializeGlobalReachConnectionData(J { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs index 30abfd244d4c..cf6897186476 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/HcxEnterpriseSiteData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs @@ -34,7 +33,7 @@ internal static HcxEnterpriseSiteData DeserializeHcxEnterpriseSiteData(JsonEleme { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs index 56dda8283cf6..87c49aa37f5f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PlacementPolicyData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; namespace Azure.ResourceManager.Avs @@ -45,7 +44,7 @@ internal static PlacementPolicyData DeserializePlacementPolicyData(JsonElement e } if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudData.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudData.Serialization.cs index b1151a5bc33b..dabd54a9708d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudData.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/PrivateCloudData.Serialization.cs @@ -8,9 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { @@ -102,7 +100,7 @@ internal static PrivateCloudData DeserializePrivateCloudData(JsonElement element Sku sku = default; Optional identity = default; IDictionary tags = default; - Location location = default; + AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; @@ -158,7 +156,7 @@ internal static PrivateCloudData DeserializePrivateCloudData(JsonElement element } if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletData.Serialization.cs similarity index 87% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletData.Serialization.cs index c7b6a488a5ee..c36c46f8d6cb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletData.Serialization.cs @@ -8,11 +8,11 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class ScriptCmdlet : IUtf8JsonSerializable + public partial class ScriptCmdletData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -23,7 +23,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ScriptCmdlet DeserializeScriptCmdlet(JsonElement element) + internal static ScriptCmdletData DeserializeScriptCmdletData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -35,7 +35,7 @@ internal static ScriptCmdlet DeserializeScriptCmdlet(JsonElement element) { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -86,7 +86,7 @@ internal static ScriptCmdlet DeserializeScriptCmdlet(JsonElement element) continue; } } - return new ScriptCmdlet(id, name, type, description.Value, timeout.Value, Optional.ToList(parameters)); + return new ScriptCmdletData(id, name, type, description.Value, timeout.Value, Optional.ToList(parameters)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs index fc6f49347562..c00f01587987 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class ScriptCmdletsList { internal static ScriptCmdletsList DeserializeScriptCmdletsList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static ScriptCmdletsList DeserializeScriptCmdletsList(JsonElement eleme property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ScriptCmdlet.DeserializeScriptCmdlet(item)); + array.Add(ScriptCmdletData.DeserializeScriptCmdletData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs index 8350df081fef..b051b0ff76d8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdletsList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class ScriptCmdletsList /// Initializes a new instance of ScriptCmdletsList. internal ScriptCmdletsList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of ScriptCmdletsList. /// List of scripts. /// URL to get the next page if any. - internal ScriptCmdletsList(IReadOnlyList value, string nextLink) + internal ScriptCmdletsList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// List of scripts. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs similarity index 94% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs index 2c9e7954cfdc..4850c9a1ecf6 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionData.Serialization.cs @@ -9,11 +9,11 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class ScriptExecution : IUtf8JsonSerializable + public partial class ScriptExecutionData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -85,7 +85,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ScriptExecution DeserializeScriptExecution(JsonElement element) + internal static ScriptExecutionData DeserializeScriptExecutionData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -109,7 +109,7 @@ internal static ScriptExecution DeserializeScriptExecution(JsonElement element) { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -300,7 +300,7 @@ internal static ScriptExecution DeserializeScriptExecution(JsonElement element) continue; } } - return new ScriptExecution(id, name, type, scriptCmdletId.Value, Optional.ToList(parameters), Optional.ToList(hiddenParameters), failureReason.Value, timeout.Value, retention.Value, Optional.ToNullable(submittedAt), Optional.ToNullable(startedAt), Optional.ToNullable(finishedAt), Optional.ToNullable(provisioningState), Optional.ToList(output), Optional.ToDictionary(namedOutputs), Optional.ToList(information), Optional.ToList(warnings), Optional.ToList(errors)); + return new ScriptExecutionData(id, name, type, scriptCmdletId.Value, Optional.ToList(parameters), Optional.ToList(hiddenParameters), failureReason.Value, timeout.Value, retention.Value, Optional.ToNullable(submittedAt), Optional.ToNullable(startedAt), Optional.ToNullable(finishedAt), Optional.ToNullable(provisioningState), Optional.ToList(output), Optional.ToDictionary(namedOutputs), Optional.ToList(information), Optional.ToList(warnings), Optional.ToList(errors)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs index 70d29c9a747e..08c85b9bbca1 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class ScriptExecutionsList { internal static ScriptExecutionsList DeserializeScriptExecutionsList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static ScriptExecutionsList DeserializeScriptExecutionsList(JsonElement property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ScriptExecution.DeserializeScriptExecution(item)); + array.Add(ScriptExecutionData.DeserializeScriptExecutionData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs index 0ee7fdf56b3f..4c81417d6982 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecutionsList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class ScriptExecutionsList /// Initializes a new instance of ScriptExecutionsList. internal ScriptExecutionsList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of ScriptExecutionsList. /// List of scripts. /// URL to get the next page if any. - internal ScriptExecutionsList(IReadOnlyList value, string nextLink) + internal ScriptExecutionsList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// List of scripts. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageData.Serialization.cs similarity index 85% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageData.Serialization.cs index acc1bac25536..d4633e89803e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackageData.Serialization.cs @@ -7,11 +7,10 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class ScriptPackage : IUtf8JsonSerializable + public partial class ScriptPackageData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -22,7 +21,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static ScriptPackage DeserializeScriptPackage(JsonElement element) + internal static ScriptPackageData DeserializeScriptPackageData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -33,7 +32,7 @@ internal static ScriptPackage DeserializeScriptPackage(JsonElement element) { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -69,7 +68,7 @@ internal static ScriptPackage DeserializeScriptPackage(JsonElement element) continue; } } - return new ScriptPackage(id, name, type, description.Value, version.Value); + return new ScriptPackageData(id, name, type, description.Value, version.Value); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs index 0132c4d226de..6e93d5d044e3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class ScriptPackagesList { internal static ScriptPackagesList DeserializeScriptPackagesList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static ScriptPackagesList DeserializeScriptPackagesList(JsonElement ele property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ScriptPackage.DeserializeScriptPackage(item)); + array.Add(ScriptPackageData.DeserializeScriptPackageData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs index c5db2cf52598..b012b2055a38 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackagesList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class ScriptPackagesList /// Initializes a new instance of ScriptPackagesList. internal ScriptPackagesList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of ScriptPackagesList. /// List of script package resources. /// URL to get the next page if any. - internal ScriptPackagesList(IReadOnlyList value, string nextLink) + internal ScriptPackagesList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// List of script package resources. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineData.Serialization.cs similarity index 86% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineData.Serialization.cs index e57c77d614e0..a67cd78a8909 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachineData.Serialization.cs @@ -7,11 +7,11 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class VirtualMachine : IUtf8JsonSerializable + public partial class VirtualMachineData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -22,7 +22,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static VirtualMachine DeserializeVirtualMachine(JsonElement element) + internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -35,7 +35,7 @@ internal static VirtualMachine DeserializeVirtualMachine(JsonElement element) { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -86,7 +86,7 @@ internal static VirtualMachine DeserializeVirtualMachine(JsonElement element) continue; } } - return new VirtualMachine(id, name, type, displayName.Value, moRefId.Value, folderPath.Value, Optional.ToNullable(restrictMovement)); + return new VirtualMachineData(id, name, type, displayName.Value, moRefId.Value, folderPath.Value, Optional.ToNullable(restrictMovement)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs index 1f2a622a96ab..227d6d1329ff 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class VirtualMachinesList { internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static VirtualMachinesList DeserializeVirtualMachinesList(JsonElement e property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(VirtualMachine.DeserializeVirtualMachine(item)); + array.Add(VirtualMachineData.DeserializeVirtualMachineData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs index b6e2e2be4915..0f92b69ddf18 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachinesList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class VirtualMachinesList /// Initializes a new instance of VirtualMachinesList. internal VirtualMachinesList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of VirtualMachinesList. /// The items to be displayed on the page. /// URL to get the next page if any. - internal VirtualMachinesList(IReadOnlyList value, string nextLink) + internal VirtualMachinesList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items to be displayed on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpData.Serialization.cs similarity index 80% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpData.Serialization.cs index 3ed9fdb73f05..15c9e6ca4437 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpData.Serialization.cs @@ -7,11 +7,11 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkDhcp : IUtf8JsonSerializable + public partial class WorkloadNetworkDhcpData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -24,7 +24,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static WorkloadNetworkDhcp DeserializeWorkloadNetworkDhcp(JsonElement element) + internal static WorkloadNetworkDhcpData DeserializeWorkloadNetworkDhcpData(JsonElement element) { Optional properties = default; ResourceIdentifier id = default; @@ -44,7 +44,7 @@ internal static WorkloadNetworkDhcp DeserializeWorkloadNetworkDhcp(JsonElement e } if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -58,7 +58,7 @@ internal static WorkloadNetworkDhcp DeserializeWorkloadNetworkDhcp(JsonElement e continue; } } - return new WorkloadNetworkDhcp(id, name, type, properties.Value); + return new WorkloadNetworkDhcpData(id, name, type, properties.Value); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs index bcd1ff8197e4..d20269481918 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class WorkloadNetworkDhcpList { internal static WorkloadNetworkDhcpList DeserializeWorkloadNetworkDhcpList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static WorkloadNetworkDhcpList DeserializeWorkloadNetworkDhcpList(JsonE property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(item)); + array.Add(WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs index 41fb64107c4b..563f1b69d8e3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcpList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class WorkloadNetworkDhcpList /// Initializes a new instance of WorkloadNetworkDhcpList. internal WorkloadNetworkDhcpList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of WorkloadNetworkDhcpList. /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkDhcpList(IReadOnlyList value, string nextLink) + internal WorkloadNetworkDhcpList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceData.Serialization.cs similarity index 91% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceData.Serialization.cs index d9665d429d5b..9d0e9e77848c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServiceData.Serialization.cs @@ -8,11 +8,11 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkDnsService : IUtf8JsonSerializable + public partial class WorkloadNetworkDnsServiceData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -58,7 +58,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static WorkloadNetworkDnsService DeserializeWorkloadNetworkDnsService(JsonElement element) + internal static WorkloadNetworkDnsServiceData DeserializeWorkloadNetworkDnsServiceData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -75,7 +75,7 @@ internal static WorkloadNetworkDnsService DeserializeWorkloadNetworkDnsService(J { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -171,7 +171,7 @@ internal static WorkloadNetworkDnsService DeserializeWorkloadNetworkDnsService(J continue; } } - return new WorkloadNetworkDnsService(id, name, type, displayName.Value, dnsServiceIp.Value, defaultDnsZone.Value, Optional.ToList(fqdnZones), Optional.ToNullable(logLevel), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + return new WorkloadNetworkDnsServiceData(id, name, type, displayName.Value, dnsServiceIp.Value, defaultDnsZone.Value, Optional.ToList(fqdnZones), Optional.ToNullable(logLevel), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs index 8b0c4db8e5a5..9aae23aaa482 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class WorkloadNetworkDnsServicesList { internal static WorkloadNetworkDnsServicesList DeserializeWorkloadNetworkDnsServicesList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static WorkloadNetworkDnsServicesList DeserializeWorkloadNetworkDnsServ property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(item)); + array.Add(WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs index 1b0108d201f3..76a80cc2cc7d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsServicesList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class WorkloadNetworkDnsServicesList /// Initializes a new instance of WorkloadNetworkDnsServicesList. internal WorkloadNetworkDnsServicesList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of WorkloadNetworkDnsServicesList. /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkDnsServicesList(IReadOnlyList value, string nextLink) + internal WorkloadNetworkDnsServicesList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneData.Serialization.cs similarity index 92% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneData.Serialization.cs index 9c5fab3f05cc..e1c480483b67 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZoneData.Serialization.cs @@ -8,11 +8,11 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkDnsZone : IUtf8JsonSerializable + public partial class WorkloadNetworkDnsZoneData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -63,7 +63,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static WorkloadNetworkDnsZone DeserializeWorkloadNetworkDnsZone(JsonElement element) + internal static WorkloadNetworkDnsZoneData DeserializeWorkloadNetworkDnsZoneData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -79,7 +79,7 @@ internal static WorkloadNetworkDnsZone DeserializeWorkloadNetworkDnsZone(JsonEle { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -175,7 +175,7 @@ internal static WorkloadNetworkDnsZone DeserializeWorkloadNetworkDnsZone(JsonEle continue; } } - return new WorkloadNetworkDnsZone(id, name, type, displayName.Value, Optional.ToList(domain), Optional.ToList(dnsServerIps), sourceIp.Value, Optional.ToNullable(dnsServices), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + return new WorkloadNetworkDnsZoneData(id, name, type, displayName.Value, Optional.ToList(domain), Optional.ToList(dnsServerIps), sourceIp.Value, Optional.ToNullable(dnsServices), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs index a10eddb1aa9e..f68c675bfe0b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class WorkloadNetworkDnsZonesList { internal static WorkloadNetworkDnsZonesList DeserializeWorkloadNetworkDnsZonesList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static WorkloadNetworkDnsZonesList DeserializeWorkloadNetworkDnsZonesLi property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(item)); + array.Add(WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs index c3c450e2e492..4bc05586abc0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZonesList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class WorkloadNetworkDnsZonesList /// Initializes a new instance of WorkloadNetworkDnsZonesList. internal WorkloadNetworkDnsZonesList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of WorkloadNetworkDnsZonesList. /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkDnsZonesList(IReadOnlyList value, string nextLink) + internal WorkloadNetworkDnsZonesList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayData.Serialization.cs similarity index 85% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayData.Serialization.cs index edeff8e38c32..74ff5df6544f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayData.Serialization.cs @@ -7,11 +7,10 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkGateway : IUtf8JsonSerializable + public partial class WorkloadNetworkGatewayData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -27,7 +26,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static WorkloadNetworkGateway DeserializeWorkloadNetworkGateway(JsonElement element) + internal static WorkloadNetworkGatewayData DeserializeWorkloadNetworkGatewayData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -38,7 +37,7 @@ internal static WorkloadNetworkGateway DeserializeWorkloadNetworkGateway(JsonEle { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -74,7 +73,7 @@ internal static WorkloadNetworkGateway DeserializeWorkloadNetworkGateway(JsonEle continue; } } - return new WorkloadNetworkGateway(id, name, type, displayName.Value, path.Value); + return new WorkloadNetworkGatewayData(id, name, type, displayName.Value, path.Value); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs index e9af3786ef3b..95f691488582 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class WorkloadNetworkGatewayList { internal static WorkloadNetworkGatewayList DeserializeWorkloadNetworkGatewayList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static WorkloadNetworkGatewayList DeserializeWorkloadNetworkGatewayList property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkGateway.DeserializeWorkloadNetworkGateway(item)); + array.Add(WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs index 5463b58d614e..e6e1b4c38ace 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGatewayList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class WorkloadNetworkGatewayList /// Initializes a new instance of WorkloadNetworkGatewayList. internal WorkloadNetworkGatewayList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of WorkloadNetworkGatewayList. /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkGatewayList(IReadOnlyList value, string nextLink) + internal WorkloadNetworkGatewayList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringData.Serialization.cs similarity index 90% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringData.Serialization.cs index 3be5a500d5db..44c2ed49fd45 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringData.Serialization.cs @@ -7,11 +7,11 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkPortMirroring : IUtf8JsonSerializable + public partial class WorkloadNetworkPortMirroringData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -47,7 +47,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static WorkloadNetworkPortMirroring DeserializeWorkloadNetworkPortMirroring(JsonElement element) + internal static WorkloadNetworkPortMirroringData DeserializeWorkloadNetworkPortMirroringData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -63,7 +63,7 @@ internal static WorkloadNetworkPortMirroring DeserializeWorkloadNetworkPortMirro { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -144,7 +144,7 @@ internal static WorkloadNetworkPortMirroring DeserializeWorkloadNetworkPortMirro continue; } } - return new WorkloadNetworkPortMirroring(id, name, type, displayName.Value, Optional.ToNullable(direction), source.Value, destination.Value, Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + return new WorkloadNetworkPortMirroringData(id, name, type, displayName.Value, Optional.ToNullable(direction), source.Value, destination.Value, Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs index 97c1a406eb00..d58a8ec0f9eb 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class WorkloadNetworkPortMirroringList { internal static WorkloadNetworkPortMirroringList DeserializeWorkloadNetworkPortMirroringList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static WorkloadNetworkPortMirroringList DeserializeWorkloadNetworkPortM property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(item)); + array.Add(WorkloadNetworkPortMirroringData.DeserializeWorkloadNetworkPortMirroringData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs index 2838342d3d55..db27f74e591c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroringList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class WorkloadNetworkPortMirroringList /// Initializes a new instance of WorkloadNetworkPortMirroringList. internal WorkloadNetworkPortMirroringList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of WorkloadNetworkPortMirroringList. /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkPortMirroringList(IReadOnlyList value, string nextLink) + internal WorkloadNetworkPortMirroringList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPData.Serialization.cs similarity index 87% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPData.Serialization.cs index c10c4ab8a1ba..3ab6d43cfa59 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPData.Serialization.cs @@ -7,11 +7,11 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkPublicIP : IUtf8JsonSerializable + public partial class WorkloadNetworkPublicIPData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -32,7 +32,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static WorkloadNetworkPublicIP DeserializeWorkloadNetworkPublicIP(JsonElement element) + internal static WorkloadNetworkPublicIPData DeserializeWorkloadNetworkPublicIPData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -45,7 +45,7 @@ internal static WorkloadNetworkPublicIP DeserializeWorkloadNetworkPublicIP(JsonE { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -101,7 +101,7 @@ internal static WorkloadNetworkPublicIP DeserializeWorkloadNetworkPublicIP(JsonE continue; } } - return new WorkloadNetworkPublicIP(id, name, type, displayName.Value, Optional.ToNullable(numberOfPublicIPs), publicIPBlock.Value, Optional.ToNullable(provisioningState)); + return new WorkloadNetworkPublicIPData(id, name, type, displayName.Value, Optional.ToNullable(numberOfPublicIPs), publicIPBlock.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs index 0608a98a1c81..1f36195dfaab 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class WorkloadNetworkPublicIPsList { internal static WorkloadNetworkPublicIPsList DeserializeWorkloadNetworkPublicIPsList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static WorkloadNetworkPublicIPsList DeserializeWorkloadNetworkPublicIPs property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(item)); + array.Add(WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs index cdf9298995ab..0caf8e082b41 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIPsList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class WorkloadNetworkPublicIPsList /// Initializes a new instance of WorkloadNetworkPublicIPsList. internal WorkloadNetworkPublicIPsList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of WorkloadNetworkPublicIPsList. /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkPublicIPsList(IReadOnlyList value, string nextLink) + internal WorkloadNetworkPublicIPsList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs similarity index 91% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs index 5def71aa5c03..23d9c3476da3 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentData.Serialization.cs @@ -8,11 +8,11 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkSegment : IUtf8JsonSerializable + public partial class WorkloadNetworkSegmentData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -43,7 +43,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static WorkloadNetworkSegment DeserializeWorkloadNetworkSegment(JsonElement element) + internal static WorkloadNetworkSegmentData DeserializeWorkloadNetworkSegmentData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -59,7 +59,7 @@ internal static WorkloadNetworkSegment DeserializeWorkloadNetworkSegment(JsonEle { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -150,7 +150,7 @@ internal static WorkloadNetworkSegment DeserializeWorkloadNetworkSegment(JsonEle continue; } } - return new WorkloadNetworkSegment(id, name, type, displayName.Value, connectedGateway.Value, subnet.Value, Optional.ToList(portVif), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + return new WorkloadNetworkSegmentData(id, name, type, displayName.Value, connectedGateway.Value, subnet.Value, Optional.ToList(portVif), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs index dc19e0bb2492..53f1006361cf 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class WorkloadNetworkSegmentsList { internal static WorkloadNetworkSegmentsList DeserializeWorkloadNetworkSegmentsList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static WorkloadNetworkSegmentsList DeserializeWorkloadNetworkSegmentsLi property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(item)); + array.Add(WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs index 91f4148c95ef..e2ee4ad25dcf 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegmentsList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class WorkloadNetworkSegmentsList /// Initializes a new instance of WorkloadNetworkSegmentsList. internal WorkloadNetworkSegmentsList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of WorkloadNetworkSegmentsList. /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkSegmentsList(IReadOnlyList value, string nextLink) + internal WorkloadNetworkSegmentsList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupData.Serialization.cs similarity index 90% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupData.Serialization.cs index c3de138840ce..d857b815e580 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupData.Serialization.cs @@ -8,11 +8,11 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkVMGroup : IUtf8JsonSerializable + public partial class WorkloadNetworkVMGroupData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -43,7 +43,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static WorkloadNetworkVMGroup DeserializeWorkloadNetworkVMGroup(JsonElement element) + internal static WorkloadNetworkVMGroupData DeserializeWorkloadNetworkVMGroupData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -57,7 +57,7 @@ internal static WorkloadNetworkVMGroup DeserializeWorkloadNetworkVMGroup(JsonEle { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -133,7 +133,7 @@ internal static WorkloadNetworkVMGroup DeserializeWorkloadNetworkVMGroup(JsonEle continue; } } - return new WorkloadNetworkVMGroup(id, name, type, displayName.Value, Optional.ToList(members), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); + return new WorkloadNetworkVMGroupData(id, name, type, displayName.Value, Optional.ToList(members), Optional.ToNullable(status), Optional.ToNullable(provisioningState), Optional.ToNullable(revision)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.Serialization.cs index a2972fd6a471..e97abc49d471 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class WorkloadNetworkVMGroupsList { internal static WorkloadNetworkVMGroupsList DeserializeWorkloadNetworkVMGroupsList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static WorkloadNetworkVMGroupsList DeserializeWorkloadNetworkVMGroupsLi property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(item)); + array.Add(WorkloadNetworkVMGroupData.DeserializeWorkloadNetworkVMGroupData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.cs index 71e58fe257f9..8031ddf9296d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroupsList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class WorkloadNetworkVMGroupsList /// Initializes a new instance of WorkloadNetworkVMGroupsList. internal WorkloadNetworkVMGroupsList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of WorkloadNetworkVMGroupsList. /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkVMGroupsList(IReadOnlyList value, string nextLink) + internal WorkloadNetworkVMGroupsList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineData.Serialization.cs similarity index 84% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.Serialization.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineData.Serialization.cs index cc261fc70a09..3513ad018a1c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachineData.Serialization.cs @@ -7,11 +7,11 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - public partial class WorkloadNetworkVirtualMachine : IUtf8JsonSerializable + public partial class WorkloadNetworkVirtualMachineData : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -27,7 +27,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static WorkloadNetworkVirtualMachine DeserializeWorkloadNetworkVirtualMachine(JsonElement element) + internal static WorkloadNetworkVirtualMachineData DeserializeWorkloadNetworkVirtualMachineData(JsonElement element) { ResourceIdentifier id = default; string name = default; @@ -38,7 +38,7 @@ internal static WorkloadNetworkVirtualMachine DeserializeWorkloadNetworkVirtualM { if (property.NameEquals("id")) { - id = property.Value.GetString(); + id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) @@ -79,7 +79,7 @@ internal static WorkloadNetworkVirtualMachine DeserializeWorkloadNetworkVirtualM continue; } } - return new WorkloadNetworkVirtualMachine(id, name, type, displayName.Value, Optional.ToNullable(vmType)); + return new WorkloadNetworkVirtualMachineData(id, name, type, displayName.Value, Optional.ToNullable(vmType)); } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs index 8a434572fa26..ab78ec9944a7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -15,7 +16,7 @@ internal partial class WorkloadNetworkVirtualMachinesList { internal static WorkloadNetworkVirtualMachinesList DeserializeWorkloadNetworkVirtualMachinesList(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -26,10 +27,10 @@ internal static WorkloadNetworkVirtualMachinesList DeserializeWorkloadNetworkVir property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(WorkloadNetworkVirtualMachine.DeserializeWorkloadNetworkVirtualMachine(item)); + array.Add(WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(item)); } value = array; continue; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs index 89b2094dacc4..659d8b38d66e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachinesList.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Avs; namespace Azure.ResourceManager.Avs.Models { @@ -16,20 +17,20 @@ internal partial class WorkloadNetworkVirtualMachinesList /// Initializes a new instance of WorkloadNetworkVirtualMachinesList. internal WorkloadNetworkVirtualMachinesList() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of WorkloadNetworkVirtualMachinesList. /// The items on the page. /// URL to get the next page if any. - internal WorkloadNetworkVirtualMachinesList(IReadOnlyList value, string nextLink) + internal WorkloadNetworkVirtualMachinesList(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// The items on the page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// URL to get the next page if any. public string NextLink { get; } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicy.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicy.cs index 065ce13e1da1..485eb7f0686c 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicy.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicy.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using Azure; @@ -15,15 +16,20 @@ using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { /// A Class representing a PlacementPolicy along with the instance operations that can be performed on it. public partial class PlacementPolicy : ArmResource { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"; + return new ResourceIdentifier(resourceId); + } private readonly ClientDiagnostics _clientDiagnostics; - private readonly PlacementPoliciesRestOperations _restClient; + private readonly PlacementPoliciesRestOperations _placementPoliciesRestClient; private readonly PlacementPolicyData _data; /// Initializes a new instance of the class for mocking. @@ -33,13 +39,16 @@ protected PlacementPolicy() /// Initializes a new instance of the class. /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal PlacementPolicy(ArmResource options, PlacementPolicyData resource) : base(options, resource.Id) + /// The resource that is the target of operations. + internal PlacementPolicy(ArmResource options, PlacementPolicyData data) : base(options, data.Id) { HasData = true; - _data = resource; + _data = data; _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _placementPoliciesRestClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -48,7 +57,10 @@ internal PlacementPolicy(ArmResource options, PlacementPolicyData resource) : ba internal PlacementPolicy(ArmResource options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _placementPoliciesRestClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -60,15 +72,15 @@ internal PlacementPolicy(ArmResource options, ResourceIdentifier id) : base(opti internal PlacementPolicy(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _placementPoliciesRestClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters/placementPolicies"; - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - /// Gets whether or not the current instance has data. public virtual bool HasData { get; } @@ -84,6 +96,12 @@ public virtual PlacementPolicyData Data } } + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + /// Get a placement policy by name in a private cloud cluster. /// The cancellation token to use. public async virtual Task> GetAsync(CancellationToken cancellationToken = default) @@ -92,7 +110,7 @@ public async virtual Task> GetAsync(CancellationToken scope.Start(); try { - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _placementPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new PlacementPolicy(this, response.Value), response.GetRawResponse()); @@ -112,7 +130,7 @@ public virtual Response Get(CancellationToken cancellationToken scope.Start(); try { - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var response = _placementPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new PlacementPolicy(this, response.Value), response.GetRawResponse()); @@ -127,30 +145,50 @@ public virtual Response Get(CancellationToken cancellationToken /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + using var scope = _clientDiagnostics.CreateScope("PlacementPolicy.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) { - return ListAvailableLocations(ResourceType, cancellationToken); + using var scope = _clientDiagnostics.CreateScope("PlacementPolicy.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Delete a placement policy in a private cloud cluster. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PlacementPolicy.Delete"); scope.Start(); try { - var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new PlacementPolicyDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); + var response = await _placementPoliciesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new PlacementPolicyDeleteOperation(_clientDiagnostics, Pipeline, _placementPoliciesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -165,14 +203,14 @@ public async virtual Task DeleteAsync(bool waitF /// Delete a placement policy in a private cloud cluster. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual PlacementPolicyDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual PlacementPolicyDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PlacementPolicy.Delete"); scope.Start(); try { - var response = _restClient.Delete(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new PlacementPolicyDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); + var response = _placementPoliciesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new PlacementPolicyDeleteOperation(_clientDiagnostics, Pipeline, _placementPoliciesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -189,7 +227,7 @@ public virtual PlacementPolicyDeleteOperation Delete(bool waitForCompletion = tr /// Waits for the completion of the long running operations. /// The cancellation token to use. /// is null. - public async virtual Task UpdateAsync(PlacementPolicyUpdate placementPolicyUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task UpdateAsync(bool waitForCompletion, PlacementPolicyUpdate placementPolicyUpdate, CancellationToken cancellationToken = default) { if (placementPolicyUpdate == null) { @@ -200,8 +238,8 @@ public async virtual Task UpdateAsync(PlacementP scope.Start(); try { - var response = await _restClient.UpdateAsync(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate, cancellationToken).ConfigureAwait(false); - var operation = new PlacementPolicyUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate).Request, response); + var response = await _placementPoliciesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate, cancellationToken).ConfigureAwait(false); + var operation = new PlacementPolicyUpdateOperation(this, _clientDiagnostics, Pipeline, _placementPoliciesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -218,7 +256,7 @@ public async virtual Task UpdateAsync(PlacementP /// Waits for the completion of the long running operations. /// The cancellation token to use. /// is null. - public virtual PlacementPolicyUpdateOperation Update(PlacementPolicyUpdate placementPolicyUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual PlacementPolicyUpdateOperation Update(bool waitForCompletion, PlacementPolicyUpdate placementPolicyUpdate, CancellationToken cancellationToken = default) { if (placementPolicyUpdate == null) { @@ -229,8 +267,8 @@ public virtual PlacementPolicyUpdateOperation Update(PlacementPolicyUpdate place scope.Start(); try { - var response = _restClient.Update(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate, cancellationToken); - var operation = new PlacementPolicyUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate).Request, response); + var response = _placementPoliciesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate, cancellationToken); + var operation = new PlacementPolicyUpdateOperation(this, _clientDiagnostics, Pipeline, _placementPoliciesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, placementPolicyUpdate).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs index 20fe984472e4..467ead00a195 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyCollection.cs @@ -8,55 +8,46 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; namespace Azure.ResourceManager.Avs { - /// A class representing collection of PlacementPolicy and their operations over a Cluster. + /// A class representing collection of PlacementPolicy and their operations over its parent. public partial class PlacementPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _clientDiagnostics; - private readonly PlacementPoliciesRestOperations _restClient; + private readonly PlacementPoliciesRestOperations _placementPoliciesRestClient; /// Initializes a new instance of the class for mocking. protected PlacementPolicyCollection() { } - /// Initializes a new instance of PlacementPolicyCollection class. + /// Initializes a new instance of the class. /// The resource representing the parent resource. internal PlacementPolicyCollection(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _placementPoliciesRestClient = new PlacementPoliciesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } - IEnumerator IEnumerable.GetEnumerator() + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetAll().GetEnumerator(); + if (id.ResourceType != Cluster.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, Cluster.ResourceType), nameof(id)); } - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); - } - - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => Cluster.ResourceType; - // Collection level operations. /// Create or update a placement policy in a private cloud cluster. @@ -65,7 +56,7 @@ IAsyncEnumerator IAsyncEnumerable.GetAsyncEnum /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public virtual PlacementPolicyCreateOrUpdateOperation CreateOrUpdate(string placementPolicyName, PlacementPolicyData placementPolicy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual PlacementPolicyCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string placementPolicyName, PlacementPolicyData placementPolicy, CancellationToken cancellationToken = default) { if (placementPolicyName == null) { @@ -80,8 +71,8 @@ public virtual PlacementPolicyCreateOrUpdateOperation CreateOrUpdate(string plac scope.Start(); try { - var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy, cancellationToken); - var operation = new PlacementPolicyCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy).Request, response); + var response = _placementPoliciesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy, cancellationToken); + var operation = new PlacementPolicyCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _placementPoliciesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -99,7 +90,7 @@ public virtual PlacementPolicyCreateOrUpdateOperation CreateOrUpdate(string plac /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public async virtual Task CreateOrUpdateAsync(string placementPolicyName, PlacementPolicyData placementPolicy, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string placementPolicyName, PlacementPolicyData placementPolicy, CancellationToken cancellationToken = default) { if (placementPolicyName == null) { @@ -114,8 +105,8 @@ public async virtual Task CreateOrUpdate scope.Start(); try { - var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy, cancellationToken).ConfigureAwait(false); - var operation = new PlacementPolicyCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy).Request, response); + var response = await _placementPoliciesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy, cancellationToken).ConfigureAwait(false); + var operation = new PlacementPolicyCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _placementPoliciesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, placementPolicy).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -127,21 +118,22 @@ public async virtual Task CreateOrUpdate } } - /// Gets details for this resource from the service. + /// Get a placement policy by name in a private cloud cluster. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response Get(string placementPolicyName, CancellationToken cancellationToken = default) { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.Get"); scope.Start(); try { - if (placementPolicyName == null) - { - throw new ArgumentNullException(nameof(placementPolicyName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken); + var response = _placementPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new PlacementPolicy(Parent, response.Value), response.GetRawResponse()); @@ -153,21 +145,22 @@ public virtual Response Get(string placementPolicyName, Cancell } } - /// Gets details for this resource from the service. + /// Get a placement policy by name in a private cloud cluster. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetAsync(string placementPolicyName, CancellationToken cancellationToken = default) { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.Get"); scope.Start(); try { - if (placementPolicyName == null) - { - throw new ArgumentNullException(nameof(placementPolicyName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _placementPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new PlacementPolicy(Parent, response.Value), response.GetRawResponse()); @@ -181,22 +174,23 @@ public async virtual Task> GetAsync(string placementPo /// Tries to get details for this resource from the service. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response GetIfExists(string placementPolicyName, CancellationToken cancellationToken = default) { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.GetIfExists"); scope.Start(); try { - if (placementPolicyName == null) - { - throw new ArgumentNullException(nameof(placementPolicyName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new PlacementPolicy(this, response.Value), response.GetRawResponse()); + var response = _placementPoliciesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new PlacementPolicy(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -207,22 +201,23 @@ public virtual Response GetIfExists(string placementPolicyName, /// Tries to get details for this resource from the service. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetIfExistsAsync(string placementPolicyName, CancellationToken cancellationToken = default) { + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.GetIfExists"); scope.Start(); try { - if (placementPolicyName == null) - { - throw new ArgumentNullException(nameof(placementPolicyName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new PlacementPolicy(this, response.Value), response.GetRawResponse()); + var response = await _placementPoliciesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, placementPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new PlacementPolicy(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -233,18 +228,19 @@ public async virtual Task> GetIfExistsAsync(string pla /// Tries to get details for this resource from the service. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string placementPolicyName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string placementPolicyName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.CheckIfExists"); + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.Exists"); scope.Start(); try { - if (placementPolicyName == null) - { - throw new ArgumentNullException(nameof(placementPolicyName)); - } - var response = GetIfExists(placementPolicyName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -257,18 +253,19 @@ public virtual Response CheckIfExists(string placementPolicyName, Cancella /// Tries to get details for this resource from the service. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string placementPolicyName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string placementPolicyName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.CheckIfExists"); + if (placementPolicyName == null) + { + throw new ArgumentNullException(nameof(placementPolicyName)); + } + + using var scope = _clientDiagnostics.CreateScope("PlacementPolicyCollection.Exists"); scope.Start(); try { - if (placementPolicyName == null) - { - throw new ArgumentNullException(nameof(placementPolicyName)); - } - var response = await GetIfExistsAsync(placementPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -290,7 +287,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAll(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + var response = _placementPoliciesRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new PlacementPolicy(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -305,7 +302,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + var response = _placementPoliciesRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new PlacementPolicy(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -328,7 +325,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _placementPoliciesRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new PlacementPolicy(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -343,7 +340,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHin scope.Start(); try { - var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _placementPoliciesRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new PlacementPolicy(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -355,7 +352,22 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHin return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + // Builders. - // public ArmBuilder Construct() { } + // public ArmBuilder Construct() { } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs index 1a292ab88d93..7a6092fc198b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PlacementPolicyData.cs @@ -5,7 +5,7 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs index 49932c849a0d..b96cd4e5f109 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloud.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using System.Threading.Tasks; using Azure; @@ -15,19 +16,21 @@ using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { /// A Class representing a PrivateCloud along with the instance operations that can be performed on it. public partial class PrivateCloud : ArmResource { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"; + return new ResourceIdentifier(resourceId); + } private readonly ClientDiagnostics _clientDiagnostics; - private readonly PrivateCloudsRestOperations _restClient; + private readonly PrivateCloudsRestOperations _privateCloudsRestClient; private readonly PrivateCloudData _data; - private WorkloadNetworksRestOperations _workloadNetworksRestClient { get; } - private ScriptPackagesRestOperations _scriptPackagesRestClient { get; } - private ScriptExecutionsRestOperations _scriptExecutionsRestClient { get; } /// Initializes a new instance of the class for mocking. protected PrivateCloud() @@ -36,16 +39,16 @@ protected PrivateCloud() /// Initializes a new instance of the class. /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal PrivateCloud(ArmResource options, PrivateCloudData resource) : base(options, resource.Id) + /// The resource that is the target of operations. + internal PrivateCloud(ArmResource options, PrivateCloudData data) : base(options, data.Id) { HasData = true; - _data = resource; + _data = data; _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _scriptExecutionsRestClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _privateCloudsRestClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -54,10 +57,10 @@ internal PrivateCloud(ArmResource options, PrivateCloudData resource) : base(opt internal PrivateCloud(ArmResource options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _scriptExecutionsRestClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _privateCloudsRestClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Initializes a new instance of the class. @@ -69,18 +72,15 @@ internal PrivateCloud(ArmResource options, ResourceIdentifier id) : base(options internal PrivateCloud(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); - _scriptExecutionsRestClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _privateCloudsRestClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds"; - /// Gets the valid resource type for the operations. - protected override ResourceType ValidResourceType => ResourceType; - /// Gets whether or not the current instance has data. public virtual bool HasData { get; } @@ -96,6 +96,12 @@ public virtual PrivateCloudData Data } } + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + /// Get a private cloud. /// The cancellation token to use. public async virtual Task> GetAsync(CancellationToken cancellationToken = default) @@ -104,7 +110,7 @@ public async virtual Task> GetAsync(CancellationToken can scope.Start(); try { - var response = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _privateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new PrivateCloud(this, response.Value), response.GetRawResponse()); @@ -124,7 +130,7 @@ public virtual Response Get(CancellationToken cancellationToken = scope.Start(); try { - var response = _restClient.Get(Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _privateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new PrivateCloud(this, response.Value), response.GetRawResponse()); @@ -139,30 +145,50 @@ public virtual Response Get(CancellationToken cancellationToken = /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) { - return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Lists all available geo-locations. /// A token to allow the caller to cancel the call to the service. The default value is . /// A collection of locations that may take multiple service requests to iterate over. - public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) { - return ListAvailableLocations(ResourceType, cancellationToken); + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// Delete a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Delete"); scope.Start(); try { - var response = await _restClient.DeleteAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new PrivateCloudDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Name).Request, response); + var response = await _privateCloudsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new PrivateCloudDeleteOperation(_clientDiagnostics, Pipeline, _privateCloudsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response); if (waitForCompletion) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -177,14 +203,14 @@ public async virtual Task DeleteAsync(bool waitForC /// Delete a private cloud. /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual PrivateCloudDeleteOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual PrivateCloudDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) { using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Delete"); scope.Start(); try { - var response = _restClient.Delete(Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new PrivateCloudDeleteOperation(_clientDiagnostics, Pipeline, _restClient.CreateDeleteRequest(Id.ResourceGroupName, Id.Name).Request, response); + var response = _privateCloudsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new PrivateCloudDeleteOperation(_clientDiagnostics, Pipeline, _privateCloudsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -205,7 +231,7 @@ public async virtual Task> AddTagAsync(string key, string { if (string.IsNullOrWhiteSpace(key)) { - throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); + throw new ArgumentNullException(nameof(key), $"{nameof(key)} provided cannot be null or a whitespace."); } using var scope = _clientDiagnostics.CreateScope("PrivateCloud.AddTag"); @@ -215,7 +241,7 @@ public async virtual Task> AddTagAsync(string key, string var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.Properties.TagsValue[key] = value; await TagResource.CreateOrUpdateAsync(originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _privateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); } catch (Exception e) @@ -234,7 +260,7 @@ public virtual Response AddTag(string key, string value, Cancellat { if (string.IsNullOrWhiteSpace(key)) { - throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); + throw new ArgumentNullException(nameof(key), $"{nameof(key)} provided cannot be null or a whitespace."); } using var scope = _clientDiagnostics.CreateScope("PrivateCloud.AddTag"); @@ -244,7 +270,7 @@ public virtual Response AddTag(string key, string value, Cancellat var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue[key] = value; TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _restClient.Get(Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _privateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); } catch (Exception e) @@ -262,7 +288,7 @@ public async virtual Task> SetTagsAsync(IDictionary> SetTagsAsync(IDictionary SetTags(IDictionary tags, { if (tags == null) { - throw new ArgumentNullException($"{nameof(tags)} provided cannot be null.", nameof(tags)); + throw new ArgumentNullException(nameof(tags), $"{nameof(tags)} provided cannot be null."); } using var scope = _clientDiagnostics.CreateScope("PrivateCloud.SetTags"); @@ -302,7 +328,7 @@ public virtual Response SetTags(IDictionary tags, var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _restClient.Get(Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _privateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); } catch (Exception e) @@ -320,7 +346,7 @@ public async virtual Task> RemoveTagAsync(string key, Can { if (string.IsNullOrWhiteSpace(key)) { - throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); + throw new ArgumentNullException(nameof(key), $"{nameof(key)} provided cannot be null or a whitespace."); } using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RemoveTag"); @@ -330,7 +356,7 @@ public async virtual Task> RemoveTagAsync(string key, Can var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.Properties.TagsValue.Remove(key); await TagResource.CreateOrUpdateAsync(originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _restClient.GetAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _privateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); } catch (Exception e) @@ -348,7 +374,7 @@ public virtual Response RemoveTag(string key, CancellationToken ca { if (string.IsNullOrWhiteSpace(key)) { - throw new ArgumentNullException($"{nameof(key)} provided cannot be null or a whitespace.", nameof(key)); + throw new ArgumentNullException(nameof(key), $"{nameof(key)} provided cannot be null or a whitespace."); } using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RemoveTag"); @@ -358,7 +384,7 @@ public virtual Response RemoveTag(string key, CancellationToken ca var originalTags = TagResource.Get(cancellationToken); originalTags.Value.Data.Properties.TagsValue.Remove(key); TagResource.CreateOrUpdate(originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _restClient.Get(Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _privateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new PrivateCloud(this, originalResponse.Value), originalResponse.GetRawResponse()); } catch (Exception e) @@ -367,34 +393,28 @@ public virtual Response RemoveTag(string key, CancellationToken ca throw; } } - /// List the admin credentials for the private cloud. + + /// Update a private cloud. + /// The private cloud properties to be updated. + /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual async Task> GetAdminCredentialsAsync(CancellationToken cancellationToken = default) + /// is null. + public async virtual Task UpdateAsync(bool waitForCompletion, PrivateCloudUpdate privateCloudUpdate, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetAdminCredentials"); - scope.Start(); - try - { - var response = await _restClient.GetAdminCredentialsAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) + if (privateCloudUpdate == null) { - scope.Failed(e); - throw; + throw new ArgumentNullException(nameof(privateCloudUpdate)); } - } - /// List the admin credentials for the private cloud. - /// The cancellation token to use. - public virtual Response GetAdminCredentials(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetAdminCredentials"); + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Update"); scope.Start(); try { - var response = _restClient.GetAdminCredentials(Id.ResourceGroupName, Id.Name, cancellationToken); - return response; + var response = await _privateCloudsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateCloudUpdate, cancellationToken).ConfigureAwait(false); + var operation = new PrivateCloudUpdateOperation(this, _clientDiagnostics, Pipeline, _privateCloudsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateCloudUpdate).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; } catch (Exception e) { @@ -403,34 +423,27 @@ public virtual Response GetAdminCredentials(CancellationToken } } - /// Get a segment by id in a private cloud workload network. + /// Update a private cloud. + /// The private cloud properties to be updated. + /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual async Task> GetWorkloadNetworkSegmentAsync(CancellationToken cancellationToken = default) + /// is null. + public virtual PrivateCloudUpdateOperation Update(bool waitForCompletion, PrivateCloudUpdate privateCloudUpdate, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegment"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetSegmentAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) + if (privateCloudUpdate == null) { - scope.Failed(e); - throw; + throw new ArgumentNullException(nameof(privateCloudUpdate)); } - } - /// Get a segment by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetWorkloadNetworkSegment(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegment"); + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Update"); scope.Start(); try { - var response = _workloadNetworksRestClient.GetSegment(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; + var response = _privateCloudsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateCloudUpdate, cancellationToken); + var operation = new PrivateCloudUpdateOperation(this, _clientDiagnostics, Pipeline, _privateCloudsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateCloudUpdate).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; } catch (Exception e) { @@ -439,16 +452,20 @@ public virtual Response GetWorkloadNetworkSegment(Cancel } } - /// Get dhcp by id in a private cloud workload network. + /// Rotate the vCenter password. + /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual async Task> GetWorkloadNetworkDhcpAsync(CancellationToken cancellationToken = default) + public async virtual Task RotateVcenterPasswordAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateVcenterPassword"); scope.Start(); try { - var response = await _workloadNetworksRestClient.GetDhcpAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; + var response = await _privateCloudsRestClient.RotateVcenterPasswordAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new PrivateCloudRotateVcenterPasswordOperation(_clientDiagnostics, Pipeline, _privateCloudsRestClient.CreateRotateVcenterPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; } catch (Exception e) { @@ -457,16 +474,20 @@ public virtual async Task> GetWorkloadNetworkDhcpA } } - /// Get dhcp by id in a private cloud workload network. + /// Rotate the vCenter password. + /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual Response GetWorkloadNetworkDhcp(CancellationToken cancellationToken = default) + public virtual PrivateCloudRotateVcenterPasswordOperation RotateVcenterPassword(bool waitForCompletion, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateVcenterPassword"); scope.Start(); try { - var response = _workloadNetworksRestClient.GetDhcp(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; + var response = _privateCloudsRestClient.RotateVcenterPassword(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new PrivateCloudRotateVcenterPasswordOperation(_clientDiagnostics, Pipeline, _privateCloudsRestClient.CreateRotateVcenterPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; } catch (Exception e) { @@ -475,16 +496,20 @@ public virtual Response GetWorkloadNetworkDhcp(Cancellation } } - /// Get a gateway by id in a private cloud workload network. + /// Rotate the NSX-T Manager password. + /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual async Task> GetWorkloadNetworkGatewayAsync(CancellationToken cancellationToken = default) + public async virtual Task RotateNsxtPasswordAsync(bool waitForCompletion, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateway"); + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateNsxtPassword"); scope.Start(); try { - var response = await _workloadNetworksRestClient.GetGatewayAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; + var response = await _privateCloudsRestClient.RotateNsxtPasswordAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new PrivateCloudRotateNsxtPasswordOperation(_clientDiagnostics, Pipeline, _privateCloudsRestClient.CreateRotateNsxtPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; } catch (Exception e) { @@ -493,16 +518,20 @@ public virtual async Task> GetWorkloadNetworkGa } } - /// Get a gateway by id in a private cloud workload network. + /// Rotate the NSX-T Manager password. + /// Waits for the completion of the long running operations. /// The cancellation token to use. - public virtual Response GetWorkloadNetworkGateway(CancellationToken cancellationToken = default) + public virtual PrivateCloudRotateNsxtPasswordOperation RotateNsxtPassword(bool waitForCompletion, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateway"); + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateNsxtPassword"); scope.Start(); try { - var response = _workloadNetworksRestClient.GetGateway(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; + var response = _privateCloudsRestClient.RotateNsxtPassword(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new PrivateCloudRotateNsxtPasswordOperation(_clientDiagnostics, Pipeline, _privateCloudsRestClient.CreateRotateNsxtPasswordRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; } catch (Exception e) { @@ -511,15 +540,15 @@ public virtual Response GetWorkloadNetworkGateway(Cancel } } - /// Get a port mirroring profile by id in a private cloud workload network. + /// List the admin credentials for the private cloud. /// The cancellation token to use. - public virtual async Task> GetWorkloadNetworkPortMirroringAsync(CancellationToken cancellationToken = default) + public async virtual Task> GetAdminCredentialsAsync(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetAdminCredentials"); scope.Start(); try { - var response = await _workloadNetworksRestClient.GetPortMirroringAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _privateCloudsRestClient.ListAdminCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -529,15 +558,15 @@ public virtual async Task> GetWorkloadNet } } - /// Get a port mirroring profile by id in a private cloud workload network. + /// List the admin credentials for the private cloud. /// The cancellation token to use. - public virtual Response GetWorkloadNetworkPortMirroring(CancellationToken cancellationToken = default) + public virtual Response GetAdminCredentials(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); + using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetAdminCredentials"); scope.Start(); try { - var response = _workloadNetworksRestClient.GetPortMirroring(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _privateCloudsRestClient.ListAdminCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -547,1316 +576,174 @@ public virtual Response GetWorkloadNetworkPortMirr } } - /// Get a vm group by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetWorkloadNetworkVMGroupAsync(CancellationToken cancellationToken = default) + #region Cluster + + /// Gets a collection of Clusters in the PrivateCloud. + /// An object representing collection of Clusters and their operations over a PrivateCloud. + public virtual ClusterCollection GetClusters() { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroup"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetVMGroupAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new ClusterCollection(this); } + #endregion - /// Get a vm group by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetWorkloadNetworkVMGroup(CancellationToken cancellationToken = default) + #region HcxEnterpriseSite + + /// Gets a collection of HcxEnterpriseSites in the PrivateCloud. + /// An object representing collection of HcxEnterpriseSites and their operations over a PrivateCloud. + public virtual HcxEnterpriseSiteCollection GetHcxEnterpriseSites() { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroup"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetVMGroup(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new HcxEnterpriseSiteCollection(this); } + #endregion - /// Get a virtual machine by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetWorkloadNetworkVirtualMachineAsync(CancellationToken cancellationToken = default) + #region ExpressRouteAuthorization + + /// Gets a collection of ExpressRouteAuthorizations in the PrivateCloud. + /// An object representing collection of ExpressRouteAuthorizations and their operations over a PrivateCloud. + public virtual ExpressRouteAuthorizationCollection GetExpressRouteAuthorizations() { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachine"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetVirtualMachineAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new ExpressRouteAuthorizationCollection(this); } + #endregion - /// Get a virtual machine by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetWorkloadNetworkVirtualMachine(CancellationToken cancellationToken = default) + #region GlobalReachConnection + + /// Gets a collection of GlobalReachConnections in the PrivateCloud. + /// An object representing collection of GlobalReachConnections and their operations over a PrivateCloud. + public virtual GlobalReachConnectionCollection GetGlobalReachConnections() { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachine"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetVirtualMachine(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new GlobalReachConnectionCollection(this); } + #endregion - /// Get a DNS service by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetWorkloadNetworkDnsServiceAsync(CancellationToken cancellationToken = default) + #region WorkloadNetworkSegment + + /// Gets a collection of WorkloadNetworkSegments in the PrivateCloud. + /// An object representing collection of WorkloadNetworkSegments and their operations over a PrivateCloud. + public virtual WorkloadNetworkSegmentCollection GetWorkloadNetworkSegments() { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsService"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetDnsServiceAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new WorkloadNetworkSegmentCollection(this); } + #endregion - /// Get a DNS service by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetWorkloadNetworkDnsService(CancellationToken cancellationToken = default) + #region WorkloadNetworkDhcp + + /// Gets a collection of WorkloadNetworkDhcps in the PrivateCloud. + /// An object representing collection of WorkloadNetworkDhcps and their operations over a PrivateCloud. + public virtual WorkloadNetworkDhcpCollection GetWorkloadNetworkDhcps() { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsService"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetDnsService(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new WorkloadNetworkDhcpCollection(this); } + #endregion - /// Get a DNS zone by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetWorkloadNetworkDnsZoneAsync(CancellationToken cancellationToken = default) + #region WorkloadNetworkGateway + + /// Gets a collection of WorkloadNetworkGateways in the PrivateCloud. + /// An object representing collection of WorkloadNetworkGateways and their operations over a PrivateCloud. + public virtual WorkloadNetworkGatewayCollection GetWorkloadNetworkGateways() { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZone"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetDnsZoneAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new WorkloadNetworkGatewayCollection(this); } + #endregion - /// Get a DNS zone by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetWorkloadNetworkDnsZone(CancellationToken cancellationToken = default) + #region WorkloadNetworkPortMirroring + + /// Gets a collection of WorkloadNetworkPortMirrorings in the PrivateCloud. + /// An object representing collection of WorkloadNetworkPortMirrorings and their operations over a PrivateCloud. + public virtual WorkloadNetworkPortMirroringCollection GetWorkloadNetworkPortMirrorings() { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZone"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetDnsZone(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new WorkloadNetworkPortMirroringCollection(this); } + #endregion - /// Get a Public IP Block by id in a private cloud workload network. - /// The cancellation token to use. - public virtual async Task> GetWorkloadNetworkPublicIPAsync(CancellationToken cancellationToken = default) + #region WorkloadNetworkVMGroup + + /// Gets a collection of WorkloadNetworkVMGroups in the PrivateCloud. + /// An object representing collection of WorkloadNetworkVMGroups and their operations over a PrivateCloud. + public virtual WorkloadNetworkVMGroupCollection GetWorkloadNetworkVMGroups() { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIP"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetPublicIPAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new WorkloadNetworkVMGroupCollection(this); } + #endregion - /// Get a Public IP Block by id in a private cloud workload network. - /// The cancellation token to use. - public virtual Response GetWorkloadNetworkPublicIP(CancellationToken cancellationToken = default) + #region WorkloadNetworkVirtualMachine + + /// Gets a collection of WorkloadNetworkVirtualMachines in the PrivateCloud. + /// An object representing collection of WorkloadNetworkVirtualMachines and their operations over a PrivateCloud. + public virtual WorkloadNetworkVirtualMachineCollection GetWorkloadNetworkVirtualMachines() { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIP"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetPublicIP(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new WorkloadNetworkVirtualMachineCollection(this); } + #endregion - /// List of segments in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWorkloadNetworkSegments(CancellationToken cancellationToken = default) + #region WorkloadNetworkDnsService + + /// Gets a collection of WorkloadNetworkDnsServices in the PrivateCloud. + /// An object representing collection of WorkloadNetworkDnsServices and their operations over a PrivateCloud. + public virtual WorkloadNetworkDnsServiceCollection GetWorkloadNetworkDnsServices() { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegments"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetSegments(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegments"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetSegmentsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + return new WorkloadNetworkDnsServiceCollection(this); } + #endregion - /// List of segments in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWorkloadNetworkSegmentsAsync(CancellationToken cancellationToken = default) + #region WorkloadNetworkDnsZone + + /// Gets a collection of WorkloadNetworkDnsZones in the PrivateCloud. + /// An object representing collection of WorkloadNetworkDnsZones and their operations over a PrivateCloud. + public virtual WorkloadNetworkDnsZoneCollection GetWorkloadNetworkDnsZones() { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegments"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetSegmentsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkSegments"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetSegmentsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + return new WorkloadNetworkDnsZoneCollection(this); } + #endregion - /// List dhcp in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWorkloadNetworkDhcp(CancellationToken cancellationToken = default) + #region WorkloadNetworkPublicIP + + /// Gets a collection of WorkloadNetworkPublicIPs in the PrivateCloud. + /// An object representing collection of WorkloadNetworkPublicIPs and their operations over a PrivateCloud. + public virtual WorkloadNetworkPublicIPCollection GetWorkloadNetworkPublicIPs() { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetDhcp(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetDhcpNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + return new WorkloadNetworkPublicIPCollection(this); } + #endregion - /// List dhcp in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWorkloadNetworkDhcpAsync(CancellationToken cancellationToken = default) + #region CloudLink + + /// Gets a collection of CloudLinks in the PrivateCloud. + /// An object representing collection of CloudLinks and their operations over a PrivateCloud. + public virtual CloudLinkCollection GetCloudLinks() { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetDhcpAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDhcp"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetDhcpNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of gateways in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWorkloadNetworkGateways(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateways"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetGateways(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateways"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetGatewaysNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of gateways in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWorkloadNetworkGatewaysAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateways"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetGatewaysAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkGateways"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetGatewaysNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of port mirroring profiles in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWorkloadNetworkPortMirroring(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetPortMirroring(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetPortMirroringNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of port mirroring profiles in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWorkloadNetworkPortMirroringAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetPortMirroringAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPortMirroring"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetPortMirroringNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of vm groups in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWorkloadNetworkVMGroups(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroups"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetVMGroups(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroups"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetVMGroupsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of vm groups in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWorkloadNetworkVMGroupsAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroups"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetVMGroupsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVMGroups"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetVMGroupsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of virtual machines in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWorkloadNetworkVirtualMachines(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachines"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetVirtualMachines(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachines"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetVirtualMachinesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of virtual machines in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWorkloadNetworkVirtualMachinesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachines"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetVirtualMachinesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkVirtualMachines"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetVirtualMachinesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of DNS services in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWorkloadNetworkDnsServices(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsServices"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetDnsServices(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsServices"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetDnsServicesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of DNS services in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWorkloadNetworkDnsServicesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsServices"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetDnsServicesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsServices"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetDnsServicesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of DNS zones in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWorkloadNetworkDnsZones(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZones"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetDnsZones(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZones"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetDnsZonesNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of DNS zones in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWorkloadNetworkDnsZonesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZones"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetDnsZonesAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkDnsZones"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetDnsZonesNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of Public IP Blocks in a private cloud workload network. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetWorkloadNetworkPublicIPs(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIPs"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetPublicIPs(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIPs"); - scope.Start(); - try - { - var response = _workloadNetworksRestClient.GetPublicIPsNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List of Public IP Blocks in a private cloud workload network. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetWorkloadNetworkPublicIPsAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIPs"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetPublicIPsAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetWorkloadNetworkPublicIPs"); - scope.Start(); - try - { - var response = await _workloadNetworksRestClient.GetPublicIPsNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - /// Get a script package available to run on a private cloud. - /// The cancellation token to use. - public virtual async Task> GetScriptPackageAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackage"); - scope.Start(); - try - { - var response = await _scriptPackagesRestClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a script package available to run on a private cloud. - /// The cancellation token to use. - public virtual Response GetScriptPackage(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackage"); - scope.Start(); - try - { - var response = _scriptPackagesRestClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// List script packages available to run on the private cloud. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScriptPackages(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackages"); - scope.Start(); - try - { - var response = _scriptPackagesRestClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackages"); - scope.Start(); - try - { - var response = _scriptPackagesRestClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List script packages available to run on the private cloud. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScriptPackagesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackages"); - scope.Start(); - try - { - var response = await _scriptPackagesRestClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptPackages"); - scope.Start(); - try - { - var response = await _scriptPackagesRestClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - /// Get an script execution by name in a private cloud. - /// The cancellation token to use. - public virtual async Task> GetScriptExecutionAsync(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecution"); - scope.Start(); - try - { - var response = await _scriptExecutionsRestClient.GetAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get an script execution by name in a private cloud. - /// The cancellation token to use. - public virtual Response GetScriptExecution(CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecution"); - scope.Start(); - try - { - var response = _scriptExecutionsRestClient.Get(Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Return the logs for a script execution resource. - /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. - /// The cancellation token to use. - public virtual async Task> GetScriptExecutionExecutionLogsAsync(IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutionExecutionLogs"); - scope.Start(); - try - { - var response = await _scriptExecutionsRestClient.GetExecutionLogsAsync(Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptOutputStreamType, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Return the logs for a script execution resource. - /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. - /// The cancellation token to use. - public virtual Response GetScriptExecutionExecutionLogs(IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutionExecutionLogs"); - scope.Start(); - try - { - var response = _scriptExecutionsRestClient.GetExecutionLogs(Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptOutputStreamType, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// List script executions in a private cloud. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetScriptExecutions(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutions"); - scope.Start(); - try - { - var response = _scriptExecutionsRestClient.GetAll(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - Page NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutions"); - scope.Start(); - try - { - var response = _scriptExecutionsRestClient.GetAllNextPage(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// List script executions in a private cloud. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetScriptExecutionsAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutions"); - scope.Start(); - try - { - var response = await _scriptExecutionsRestClient.GetAllAsync(Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.GetScriptExecutions"); - scope.Start(); - try - { - var response = await _scriptExecutionsRestClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Update a private cloud. - /// The private cloud properties to be updated. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public async virtual Task UpdateAsync(PrivateCloudUpdate privateCloudUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (privateCloudUpdate == null) - { - throw new ArgumentNullException(nameof(privateCloudUpdate)); - } - - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Update"); - scope.Start(); - try - { - var response = await _restClient.UpdateAsync(Id.ResourceGroupName, Id.Name, privateCloudUpdate, cancellationToken).ConfigureAwait(false); - var operation = new PrivateCloudUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Name, privateCloudUpdate).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Update a private cloud. - /// The private cloud properties to be updated. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - /// is null. - public virtual PrivateCloudUpdateOperation Update(PrivateCloudUpdate privateCloudUpdate, bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - if (privateCloudUpdate == null) - { - throw new ArgumentNullException(nameof(privateCloudUpdate)); - } - - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.Update"); - scope.Start(); - try - { - var response = _restClient.Update(Id.ResourceGroupName, Id.Name, privateCloudUpdate, cancellationToken); - var operation = new PrivateCloudUpdateOperation(this, _clientDiagnostics, Pipeline, _restClient.CreateUpdateRequest(Id.ResourceGroupName, Id.Name, privateCloudUpdate).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Rotate the vCenter password. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task RotateVcenterPasswordAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateVcenterPassword"); - scope.Start(); - try - { - var response = await _restClient.RotateVcenterPasswordAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new PrivateCloudRotateVcenterPasswordOperation(_clientDiagnostics, Pipeline, _restClient.CreateRotateVcenterPasswordRequest(Id.ResourceGroupName, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Rotate the vCenter password. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual PrivateCloudRotateVcenterPasswordOperation RotateVcenterPassword(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateVcenterPassword"); - scope.Start(); - try - { - var response = _restClient.RotateVcenterPassword(Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new PrivateCloudRotateVcenterPasswordOperation(_clientDiagnostics, Pipeline, _restClient.CreateRotateVcenterPasswordRequest(Id.ResourceGroupName, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Rotate the NSX-T Manager password. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public async virtual Task RotateNsxtPasswordAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateNsxtPassword"); - scope.Start(); - try - { - var response = await _restClient.RotateNsxtPasswordAsync(Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new PrivateCloudRotateNsxtPasswordOperation(_clientDiagnostics, Pipeline, _restClient.CreateRotateNsxtPasswordRequest(Id.ResourceGroupName, Id.Name).Request, response); - if (waitForCompletion) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Rotate the NSX-T Manager password. - /// Waits for the completion of the long running operations. - /// The cancellation token to use. - public virtual PrivateCloudRotateNsxtPasswordOperation RotateNsxtPassword(bool waitForCompletion = true, CancellationToken cancellationToken = default) - { - using var scope = _clientDiagnostics.CreateScope("PrivateCloud.RotateNsxtPassword"); - scope.Start(); - try - { - var response = _restClient.RotateNsxtPassword(Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new PrivateCloudRotateNsxtPasswordOperation(_clientDiagnostics, Pipeline, _restClient.CreateRotateNsxtPasswordRequest(Id.ResourceGroupName, Id.Name).Request, response); - if (waitForCompletion) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + return new CloudLinkCollection(this); } + #endregion - /// Gets a list of Clusters in the PrivateCloud. - /// An object representing collection of Clusters and their operations over a PrivateCloud. - public ClusterCollection GetClusters() - { - return new ClusterCollection(this); - } + #region Addon - /// Gets a list of HcxEnterpriseSites in the PrivateCloud. - /// An object representing collection of HcxEnterpriseSites and their operations over a PrivateCloud. - public HcxEnterpriseSiteCollection GetHcxEnterpriseSites() + /// Gets a collection of Addons in the PrivateCloud. + /// An object representing collection of Addons and their operations over a PrivateCloud. + public virtual AddonCollection GetAddons() { - return new HcxEnterpriseSiteCollection(this); + return new AddonCollection(this); } + #endregion - /// Gets a list of ExpressRouteAuthorizations in the PrivateCloud. - /// An object representing collection of ExpressRouteAuthorizations and their operations over a PrivateCloud. - public ExpressRouteAuthorizationCollection GetExpressRouteAuthorizations() - { - return new ExpressRouteAuthorizationCollection(this); - } + #region ScriptPackage - /// Gets a list of GlobalReachConnections in the PrivateCloud. - /// An object representing collection of GlobalReachConnections and their operations over a PrivateCloud. - public GlobalReachConnectionCollection GetGlobalReachConnections() + /// Gets a collection of ScriptPackages in the PrivateCloud. + /// An object representing collection of ScriptPackages and their operations over a PrivateCloud. + public virtual ScriptPackageCollection GetScriptPackages() { - return new GlobalReachConnectionCollection(this); + return new ScriptPackageCollection(this); } + #endregion - /// Gets a list of CloudLinks in the PrivateCloud. - /// An object representing collection of CloudLinks and their operations over a PrivateCloud. - public CloudLinkCollection GetCloudLinks() - { - return new CloudLinkCollection(this); - } + #region ScriptExecution - /// Gets a list of Addons in the PrivateCloud. - /// An object representing collection of Addons and their operations over a PrivateCloud. - public AddonCollection GetAddons() + /// Gets a collection of ScriptExecutions in the PrivateCloud. + /// An object representing collection of ScriptExecutions and their operations over a PrivateCloud. + public virtual ScriptExecutionCollection GetScriptExecutions() { - return new AddonCollection(this); + return new ScriptExecutionCollection(this); } + #endregion } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs index 3a92dd00b50d..bec74d6b78a5 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudCollection.cs @@ -8,6 +8,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -21,43 +22,34 @@ namespace Azure.ResourceManager.Avs { - /// A class representing collection of PrivateCloud and their operations over a ResourceGroup. + /// A class representing collection of PrivateCloud and their operations over its parent. public partial class PrivateCloudCollection : ArmCollection, IEnumerable, IAsyncEnumerable { private readonly ClientDiagnostics _clientDiagnostics; - private readonly PrivateCloudsRestOperations _restClient; + private readonly PrivateCloudsRestOperations _privateCloudsRestClient; /// Initializes a new instance of the class for mocking. protected PrivateCloudCollection() { } - /// Initializes a new instance of PrivateCloudCollection class. + /// Initializes a new instance of the class. /// The resource representing the parent resource. internal PrivateCloudCollection(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); - _restClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, Id.SubscriptionId, BaseUri); + _privateCloudsRestClient = new PrivateCloudsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif } - IEnumerator IEnumerable.GetEnumerator() - { - return GetAll().GetEnumerator(); - } - - IEnumerator IEnumerable.GetEnumerator() + internal static void ValidateResourceId(ResourceIdentifier id) { - return GetAll().GetEnumerator(); - } - - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) - { - return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + if (id.ResourceType != ResourceGroup.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroup.ResourceType), nameof(id)); } - /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => ResourceGroup.ResourceType; - // Collection level operations. /// Create or update a private cloud. @@ -66,7 +58,7 @@ IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public virtual PrivateCloudCreateOrUpdateOperation CreateOrUpdate(string privateCloudName, PrivateCloudData privateCloud, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual PrivateCloudCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string privateCloudName, PrivateCloudData privateCloud, CancellationToken cancellationToken = default) { if (privateCloudName == null) { @@ -81,8 +73,8 @@ public virtual PrivateCloudCreateOrUpdateOperation CreateOrUpdate(string private scope.Start(); try { - var response = _restClient.CreateOrUpdate(Id.ResourceGroupName, privateCloudName, privateCloud, cancellationToken); - var operation = new PrivateCloudCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, privateCloudName, privateCloud).Request, response); + var response = _privateCloudsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, privateCloud, cancellationToken); + var operation = new PrivateCloudCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _privateCloudsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, privateCloud).Request, response); if (waitForCompletion) operation.WaitForCompletion(cancellationToken); return operation; @@ -100,7 +92,7 @@ public virtual PrivateCloudCreateOrUpdateOperation CreateOrUpdate(string private /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public async virtual Task CreateOrUpdateAsync(string privateCloudName, PrivateCloudData privateCloud, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string privateCloudName, PrivateCloudData privateCloud, CancellationToken cancellationToken = default) { if (privateCloudName == null) { @@ -115,8 +107,8 @@ public async virtual Task CreateOrUpdateAsy scope.Start(); try { - var response = await _restClient.CreateOrUpdateAsync(Id.ResourceGroupName, privateCloudName, privateCloud, cancellationToken).ConfigureAwait(false); - var operation = new PrivateCloudCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _restClient.CreateCreateOrUpdateRequest(Id.ResourceGroupName, privateCloudName, privateCloud).Request, response); + var response = await _privateCloudsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, privateCloud, cancellationToken).ConfigureAwait(false); + var operation = new PrivateCloudCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _privateCloudsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, privateCloud).Request, response); if (waitForCompletion) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -128,21 +120,22 @@ public async virtual Task CreateOrUpdateAsy } } - /// Gets details for this resource from the service. + /// Get a private cloud. /// Name of the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response Get(string privateCloudName, CancellationToken cancellationToken = default) { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.Get"); scope.Start(); try { - if (privateCloudName == null) - { - throw new ArgumentNullException(nameof(privateCloudName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken); + var response = _privateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); return Response.FromValue(new PrivateCloud(Parent, response.Value), response.GetRawResponse()); @@ -154,21 +147,22 @@ public virtual Response Get(string privateCloudName, CancellationT } } - /// Gets details for this resource from the service. + /// Get a private cloud. /// Name of the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetAsync(string privateCloudName, CancellationToken cancellationToken = default) { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.Get"); scope.Start(); try { - if (privateCloudName == null) - { - throw new ArgumentNullException(nameof(privateCloudName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _privateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); return Response.FromValue(new PrivateCloud(Parent, response.Value), response.GetRawResponse()); @@ -182,22 +176,23 @@ public async virtual Task> GetAsync(string privateCloudNa /// Tries to get details for this resource from the service. /// Name of the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public virtual Response GetIfExists(string privateCloudName, CancellationToken cancellationToken = default) { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.GetIfExists"); scope.Start(); try { - if (privateCloudName == null) - { - throw new ArgumentNullException(nameof(privateCloudName)); - } - - var response = _restClient.Get(Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new PrivateCloud(this, response.Value), response.GetRawResponse()); + var response = _privateCloudsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new PrivateCloud(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -208,22 +203,23 @@ public virtual Response GetIfExists(string privateCloudName, Cance /// Tries to get details for this resource from the service. /// Name of the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . + /// The cancellation token to use. + /// is null. public async virtual Task> GetIfExistsAsync(string privateCloudName, CancellationToken cancellationToken = default) { + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.GetIfExists"); scope.Start(); try { - if (privateCloudName == null) - { - throw new ArgumentNullException(nameof(privateCloudName)); - } - - var response = await _restClient.GetAsync(Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); - return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new PrivateCloud(this, response.Value), response.GetRawResponse()); + var response = await _privateCloudsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new PrivateCloud(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -234,18 +230,19 @@ public async virtual Task> GetIfExistsAsync(string privat /// Tries to get details for this resource from the service. /// Name of the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response CheckIfExists(string privateCloudName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string privateCloudName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.CheckIfExists"); + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.Exists"); scope.Start(); try { - if (privateCloudName == null) - { - throw new ArgumentNullException(nameof(privateCloudName)); - } - var response = GetIfExists(privateCloudName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -258,18 +255,19 @@ public virtual Response CheckIfExists(string privateCloudName, Cancellatio /// Tries to get details for this resource from the service. /// Name of the private cloud. - /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> CheckIfExistsAsync(string privateCloudName, CancellationToken cancellationToken = default) + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string privateCloudName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.CheckIfExists"); + if (privateCloudName == null) + { + throw new ArgumentNullException(nameof(privateCloudName)); + } + + using var scope = _clientDiagnostics.CreateScope("PrivateCloudCollection.Exists"); scope.Start(); try { - if (privateCloudName == null) - { - throw new ArgumentNullException(nameof(privateCloudName)); - } - var response = await GetIfExistsAsync(privateCloudName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } @@ -291,7 +289,7 @@ Page FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAll(Id.ResourceGroupName, cancellationToken: cancellationToken); + var response = _privateCloudsRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -306,7 +304,7 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = _restClient.GetAllNextPage(nextLink, Id.ResourceGroupName, cancellationToken: cancellationToken); + var response = _privateCloudsRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -329,7 +327,7 @@ async Task> FirstPageFunc(int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllAsync(Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _privateCloudsRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -344,7 +342,7 @@ async Task> NextPageFunc(string nextLink, int? pageSizeHint) scope.Start(); try { - var response = await _restClient.GetAllNextPageAsync(nextLink, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _privateCloudsRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); return Page.FromValues(response.Value.Value.Select(value => new PrivateCloud(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) @@ -402,7 +400,22 @@ public virtual AsyncPageable GetAllAsGenericResourcesAsync(stri } } + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + // Builders. - // public ArmBuilder Construct() { } + // public ArmBuilder Construct() { } } } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs index 252c9ec04a7b..f70953c16a5a 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/PrivateCloudData.cs @@ -8,10 +8,8 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Avs { @@ -22,7 +20,7 @@ public partial class PrivateCloudData : TrackedResource /// The location. /// The private cloud SKU. /// is null. - public PrivateCloudData(Location location, Models.Sku sku) : base(location) + public PrivateCloudData(AzureLocation location, Models.Sku sku) : base(location) { if (sku == null) { @@ -60,7 +58,7 @@ public PrivateCloudData(Location location, Models.Sku sku) : base(location) /// Thumbprint of the NSX-T Manager SSL certificate. /// Array of cloud link IDs from other clouds that connect to this one. /// A secondary expressRoute circuit from a separate AZ. Only present in a stretched private cloud. - internal PrivateCloudData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, Models.Sku sku, PrivateCloudIdentity identity, ManagementCluster managementCluster, InternetEnum? internet, IList identitySources, AvailabilityProperties availability, Encryption encryption, PrivateCloudProvisioningState? provisioningState, Circuit circuit, Endpoints endpoints, string networkBlock, string managementNetwork, string provisioningNetwork, string vmotionNetwork, string vcenterPassword, string nsxtPassword, string vcenterCertificateThumbprint, string nsxtCertificateThumbprint, IReadOnlyList externalCloudLinks, Circuit secondaryCircuit) : base(id, name, type, tags, location) + internal PrivateCloudData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, AzureLocation location, Models.Sku sku, PrivateCloudIdentity identity, ManagementCluster managementCluster, InternetEnum? internet, IList identitySources, AvailabilityProperties availability, Encryption encryption, PrivateCloudProvisioningState? provisioningState, Circuit circuit, Endpoints endpoints, string networkBlock, string managementNetwork, string provisioningNetwork, string vmotionNetwork, string vcenterPassword, string nsxtPassword, string vcenterCertificateThumbprint, string nsxtCertificateThumbprint, IReadOnlyList externalCloudLinks, Circuit secondaryCircuit) : base(id, name, type, tags, location) { Sku = sku; Identity = identity; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs index 02438f087f7e..162ba8d54f5e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AddonsRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class AddonsRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class AddonsRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public AddonsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public AddonsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public AddonsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pi _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -66,12 +63,17 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List addons in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -81,7 +83,7 @@ public async Task> GetAllAsync(string resourceGroupName, str throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -98,12 +100,17 @@ public async Task> GetAllAsync(string resourceGroupName, str } /// List addons in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -113,7 +120,7 @@ public Response GetAll(string resourceGroupName, string privateCloudN throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -129,7 +136,7 @@ public Response GetAll(string resourceGroupName, string privateCloudN } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string addonName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -152,13 +159,18 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get an addon by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the addon for the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -172,7 +184,7 @@ public async Task> GetAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(addonName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, addonName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, addonName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -191,13 +203,18 @@ public async Task> GetAsync(string resourceGroupName, string } /// Get an addon by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the addon for the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -211,7 +228,7 @@ public Response Get(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(addonName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, addonName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, addonName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -229,7 +246,7 @@ public Response Get(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string addonName, AddonData addon) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AddonData addon) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -256,14 +273,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Create or update a addon in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the addon for the private cloud. /// A addon in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string addonName, AddonData addon, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AddonData addon, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -281,7 +303,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(addon)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, addonName, addon); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, addonName, addon); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -294,14 +316,19 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } /// Create or update a addon in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the addon for the private cloud. /// A addon in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string addonName, AddonData addon, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, AddonData addon, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -319,7 +346,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(addon)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, addonName, addon); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, addonName, addon); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -331,7 +358,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string addonName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -354,13 +381,18 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privat } /// Delete a addon in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the addon for the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -374,7 +406,7 @@ public async Task DeleteAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(addonName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, addonName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, addonName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -388,13 +420,18 @@ public async Task DeleteAsync(string resourceGroupName, string private } /// Delete a addon in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the addon for the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Delete(string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -408,7 +445,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(addonName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, addonName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, addonName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -421,7 +458,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -437,16 +474,21 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List addons in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -456,7 +498,7 @@ public async Task> GetAllNextPageAsync(string nextLink, stri throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -474,16 +516,21 @@ public async Task> GetAllNextPageAsync(string nextLink, stri /// List addons in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -493,7 +540,7 @@ public Response GetAllNextPage(string nextLink, string resourceGroupN throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs index 0dcd6a57b69f..d5af87f47e8f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/AuthorizationsRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class AuthorizationsRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class AuthorizationsRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public AuthorizationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public AuthorizationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public AuthorizationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPip _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -66,12 +63,17 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List ExpressRoute Circuit Authorizations in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -81,7 +83,7 @@ public async Task> GetAllAsync(string re throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -98,12 +100,17 @@ public async Task> GetAllAsync(string re } /// List ExpressRoute Circuit Authorizations in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -113,7 +120,7 @@ public Response GetAll(string resourceGroupName, throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -129,7 +136,7 @@ public Response GetAll(string resourceGroupName, } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string authorizationName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -152,13 +159,18 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get an ExpressRoute Circuit Authorization by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the ExpressRoute Circuit Authorization in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -172,7 +184,7 @@ public async Task> GetAsync(string resou throw new ArgumentNullException(nameof(authorizationName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, authorizationName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, authorizationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -191,13 +203,18 @@ public async Task> GetAsync(string resou } /// Get an ExpressRoute Circuit Authorization by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the ExpressRoute Circuit Authorization in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -211,7 +228,7 @@ public Response Get(string resourceGroupName, str throw new ArgumentNullException(nameof(authorizationName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, authorizationName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, authorizationName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -229,7 +246,7 @@ public Response Get(string resourceGroupName, str } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorizationData authorization) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorizationData authorization) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -256,14 +273,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Create or update an ExpressRoute Circuit Authorization in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the ExpressRoute Circuit Authorization in the private cloud. /// An ExpressRoute Circuit Authorization. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorizationData authorization, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorizationData authorization, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -281,7 +303,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(authorization)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, authorizationName, authorization); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, authorizationName, authorization); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -294,14 +316,19 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } /// Create or update an ExpressRoute Circuit Authorization in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the ExpressRoute Circuit Authorization in the private cloud. /// An ExpressRoute Circuit Authorization. /// The cancellation token to use. - /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorizationData authorization, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorizationData authorization, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -319,7 +346,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(authorization)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, authorizationName, authorization); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, authorizationName, authorization); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -331,7 +358,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string authorizationName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -354,13 +381,18 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privat } /// Delete an ExpressRoute Circuit Authorization in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the ExpressRoute Circuit Authorization in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -374,7 +406,7 @@ public async Task DeleteAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(authorizationName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, authorizationName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, authorizationName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -388,13 +420,18 @@ public async Task DeleteAsync(string resourceGroupName, string private } /// Delete an ExpressRoute Circuit Authorization in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the ExpressRoute Circuit Authorization in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Delete(string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -408,7 +445,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(authorizationName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, authorizationName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, authorizationName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -421,7 +458,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -437,16 +474,21 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List ExpressRoute Circuit Authorizations in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -456,7 +498,7 @@ public async Task> GetAllNextPageAsync(s throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -474,16 +516,21 @@ public async Task> GetAllNextPageAsync(s /// List ExpressRoute Circuit Authorizations in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -493,7 +540,7 @@ public Response GetAllNextPage(string nextLink, s throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs index 39ae2fce3910..a4e65d5a900e 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/CloudLinksRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class CloudLinksRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class CloudLinksRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public CloudLinksRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public CloudLinksRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public CloudLinksRestOperations(ClientDiagnostics clientDiagnostics, HttpPipelin _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -66,12 +63,17 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List cloud link in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -81,7 +83,7 @@ public async Task> GetAllAsync(string resourceGroupName, throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -98,12 +100,17 @@ public async Task> GetAllAsync(string resourceGroupName, } /// List cloud link in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -113,7 +120,7 @@ public Response GetAll(string resourceGroupName, string privateCl throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -129,7 +136,7 @@ public Response GetAll(string resourceGroupName, string privateCl } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string cloudLinkName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -152,13 +159,18 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get an cloud link by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cloud link resource. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -172,7 +184,7 @@ public async Task> GetAsync(string resourceGroupName, st throw new ArgumentNullException(nameof(cloudLinkName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, cloudLinkName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, cloudLinkName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -191,13 +203,18 @@ public async Task> GetAsync(string resourceGroupName, st } /// Get an cloud link by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cloud link resource. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -211,7 +228,7 @@ public Response Get(string resourceGroupName, string privateCloud throw new ArgumentNullException(nameof(cloudLinkName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, cloudLinkName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, cloudLinkName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -229,7 +246,7 @@ public Response Get(string resourceGroupName, string privateCloud } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData cloudLink) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData cloudLink) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -256,14 +273,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Create or update a cloud link in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the cloud link resource. /// A cloud link in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData cloudLink, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData cloudLink, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -281,7 +303,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(cloudLink)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, cloudLinkName, cloudLink); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, cloudLinkName, cloudLink); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -294,14 +316,19 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } /// Create or update a cloud link in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the cloud link resource. /// A cloud link in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData cloudLink, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLinkData cloudLink, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -319,7 +346,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(cloudLink)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, cloudLinkName, cloudLink); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, cloudLinkName, cloudLink); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -331,7 +358,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string cloudLinkName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -354,13 +381,18 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privat } /// Delete a cloud link in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cloud link resource. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -374,7 +406,7 @@ public async Task DeleteAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(cloudLinkName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, cloudLinkName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, cloudLinkName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -388,13 +420,18 @@ public async Task DeleteAsync(string resourceGroupName, string private } /// Delete a cloud link in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cloud link resource. /// The cancellation token to use. - /// , , or is null. - public Response Delete(string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -408,7 +445,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(cloudLinkName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, cloudLinkName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, cloudLinkName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -421,7 +458,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -437,16 +474,21 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List cloud link in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -456,7 +498,7 @@ public async Task> GetAllNextPageAsync(string nextLink, throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -474,16 +516,21 @@ public async Task> GetAllNextPageAsync(string nextLink, /// List cloud link in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -493,7 +540,7 @@ public Response GetAllNextPage(string nextLink, string resourceGr throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs index 6ca8193efecd..b6b44cbb0df8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ClustersRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class ClustersRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class ClustersRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public ClustersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public ClustersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public ClustersRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -66,12 +63,17 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List clusters in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -81,7 +83,7 @@ public async Task> GetAllAsync(string resourceGroupName, s throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -98,12 +100,17 @@ public async Task> GetAllAsync(string resourceGroupName, s } /// List clusters in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -113,7 +120,7 @@ public Response GetAll(string resourceGroupName, string privateClou throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -129,7 +136,7 @@ public Response GetAll(string resourceGroupName, string privateClou } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string clusterName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -152,13 +159,18 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get a cluster by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -172,7 +184,7 @@ public async Task> GetAsync(string resourceGroupName, stri throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -191,13 +203,18 @@ public async Task> GetAsync(string resourceGroupName, stri } /// Get a cluster by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -211,7 +228,7 @@ public Response Get(string resourceGroupName, string privateCloudNa throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -229,7 +246,7 @@ public Response Get(string resourceGroupName, string privateCloudNa } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string clusterName, ClusterData cluster) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterData cluster) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -256,14 +273,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Create or update a cluster in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the cluster in the private cloud. /// A cluster in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string clusterName, ClusterData cluster, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterData cluster, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -281,7 +303,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(cluster)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, cluster); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, cluster); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -294,14 +316,19 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } /// Create or update a cluster in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the cluster in the private cloud. /// A cluster in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string clusterName, ClusterData cluster, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterData cluster, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -319,7 +346,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(cluster)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, cluster); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, cluster); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -331,7 +358,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateUpdateRequest(string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -358,14 +385,19 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string privat } /// Update a cluster in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cluster properties to be updated. /// The cancellation token to use. - /// , , , or is null. - public async Task UpdateAsync(string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -383,7 +415,7 @@ public async Task UpdateAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(clusterUpdate)); } - using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, clusterName, clusterUpdate); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, clusterUpdate); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -396,14 +428,19 @@ public async Task UpdateAsync(string resourceGroupName, string private } /// Update a cluster in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cluster properties to be updated. /// The cancellation token to use. - /// , , , or is null. - public Response Update(string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -421,7 +458,7 @@ public Response Update(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(clusterUpdate)); } - using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, clusterName, clusterUpdate); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, clusterUpdate); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -433,7 +470,7 @@ public Response Update(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string clusterName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -456,13 +493,18 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privat } /// Delete a cluster in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -476,7 +518,7 @@ public async Task DeleteAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -490,13 +532,18 @@ public async Task DeleteAsync(string resourceGroupName, string private } /// Delete a cluster in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Delete(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -510,7 +557,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -523,7 +570,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -539,16 +586,21 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List clusters in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -558,7 +610,7 @@ public async Task> GetAllNextPageAsync(string nextLink, st throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -576,16 +628,21 @@ public async Task> GetAllNextPageAsync(string nextLink, st /// List clusters in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -595,7 +652,7 @@ public Response GetAllNextPage(string nextLink, string resourceGrou throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs index f83313a574eb..6886494069d0 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/DatastoresRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class DatastoresRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class DatastoresRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public DatastoresRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public DatastoresRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public DatastoresRestOperations(ClientDiagnostics clientDiagnostics, HttpPipelin _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName, string clusterName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -68,13 +65,18 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List datastores in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -88,7 +90,7 @@ public async Task> GetAllAsync(string resourceGroupName, throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -105,13 +107,18 @@ public async Task> GetAllAsync(string resourceGroupName, } /// List datastores in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -125,7 +132,7 @@ public Response GetAll(string resourceGroupName, string privateCl throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -141,7 +148,7 @@ public Response GetAll(string resourceGroupName, string privateCl } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -166,14 +173,19 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get a datastore in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the datastore in the private cloud cluster. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -191,7 +203,7 @@ public async Task> GetAsync(string resourceGroupName, st throw new ArgumentNullException(nameof(datastoreName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, datastoreName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, datastoreName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -210,14 +222,19 @@ public async Task> GetAsync(string resourceGroupName, st } /// Get a datastore in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the datastore in the private cloud cluster. /// The cancellation token to use. - /// , , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -235,7 +252,7 @@ public Response Get(string resourceGroupName, string privateCloud throw new ArgumentNullException(nameof(datastoreName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, datastoreName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, datastoreName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -253,7 +270,7 @@ public Response Get(string resourceGroupName, string privateCloud } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData datastore) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData datastore) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -282,15 +299,20 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Create or update a datastore in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the datastore in the private cloud cluster. /// A datastore in a private cloud cluster. /// The cancellation token to use. - /// , , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData datastore, CancellationToken cancellationToken = default) + /// , , , , , or is null. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData datastore, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -312,7 +334,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(datastore)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, datastoreName, datastore); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, datastoreName, datastore); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -325,15 +347,20 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } /// Create or update a datastore in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the datastore in the private cloud cluster. /// A datastore in a private cloud cluster. /// The cancellation token to use. - /// , , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData datastore, CancellationToken cancellationToken = default) + /// , , , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, DatastoreData datastore, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -355,7 +382,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(datastore)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, datastoreName, datastore); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, datastoreName, datastore); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -367,7 +394,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -392,14 +419,19 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privat } /// Delete a datastore in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the datastore in the private cloud cluster. /// The cancellation token to use. - /// , , , or is null. - public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -417,7 +449,7 @@ public async Task DeleteAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(datastoreName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName, datastoreName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, datastoreName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -431,14 +463,19 @@ public async Task DeleteAsync(string resourceGroupName, string private } /// Delete a datastore in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the datastore in the private cloud cluster. /// The cancellation token to use. - /// , , , or is null. - public Response Delete(string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string datastoreName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -456,7 +493,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(datastoreName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName, datastoreName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, datastoreName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -469,7 +506,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName, string clusterName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -485,17 +522,22 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List datastores in a private cloud cluster. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -509,7 +551,7 @@ public async Task> GetAllNextPageAsync(string nextLink, throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName, clusterName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -527,17 +569,22 @@ public async Task> GetAllNextPageAsync(string nextLink, /// List datastores in a private cloud cluster. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -551,7 +598,7 @@ public Response GetAllNextPage(string nextLink, string resourceGr throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName, clusterName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs index 6e159d714260..e51ade1c6faf 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/GlobalReachConnectionsRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class GlobalReachConnectionsRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class GlobalReachConnectionsRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public GlobalReachConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public GlobalReachConnectionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public GlobalReachConnectionsRestOperations(ClientDiagnostics clientDiagnostics, _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -66,12 +63,17 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List global reach connections in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -81,7 +83,7 @@ public async Task> GetAllAsync(string resour throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -98,12 +100,17 @@ public async Task> GetAllAsync(string resour } /// List global reach connections in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -113,7 +120,7 @@ public Response GetAll(string resourceGroupName, stri throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -129,7 +136,7 @@ public Response GetAll(string resourceGroupName, stri } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string globalReachConnectionName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -152,13 +159,18 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get a global reach connection by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the global reach connection in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -172,7 +184,7 @@ public async Task> GetAsync(string resourceG throw new ArgumentNullException(nameof(globalReachConnectionName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, globalReachConnectionName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, globalReachConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -191,13 +203,18 @@ public async Task> GetAsync(string resourceG } /// Get a global reach connection by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the global reach connection in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -211,7 +228,7 @@ public Response Get(string resourceGroupName, string throw new ArgumentNullException(nameof(globalReachConnectionName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, globalReachConnectionName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, globalReachConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -229,7 +246,7 @@ public Response Get(string resourceGroupName, string } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -256,14 +273,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Create or update a global reach connection in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the global reach connection in the private cloud. /// A global reach connection in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -281,7 +303,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(globalReachConnection)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -294,14 +316,19 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } /// Create or update a global reach connection in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the global reach connection in the private cloud. /// A global reach connection in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName, GlobalReachConnectionData globalReachConnection, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -319,7 +346,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(globalReachConnection)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, globalReachConnectionName, globalReachConnection); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -331,7 +358,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string globalReachConnectionName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -354,13 +381,18 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privat } /// Delete a global reach connection in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the global reach connection in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -374,7 +406,7 @@ public async Task DeleteAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(globalReachConnectionName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, globalReachConnectionName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, globalReachConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -388,13 +420,18 @@ public async Task DeleteAsync(string resourceGroupName, string private } /// Delete a global reach connection in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the global reach connection in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Delete(string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string globalReachConnectionName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -408,7 +445,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(globalReachConnectionName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, globalReachConnectionName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, globalReachConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -421,7 +458,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -437,16 +474,21 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List global reach connections in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -456,7 +498,7 @@ public async Task> GetAllNextPageAsync(strin throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -474,16 +516,21 @@ public async Task> GetAllNextPageAsync(strin /// List global reach connections in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -493,7 +540,7 @@ public Response GetAllNextPage(string nextLink, strin throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs index 4d6037cef310..a3edaad24f4f 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/HcxEnterpriseSitesRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class HcxEnterpriseSitesRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class HcxEnterpriseSitesRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public HcxEnterpriseSitesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public HcxEnterpriseSitesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public HcxEnterpriseSitesRestOperations(ClientDiagnostics clientDiagnostics, Htt _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -66,12 +63,17 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List HCX Enterprise Sites in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -81,7 +83,7 @@ public async Task> GetAllAsync(string resourceGr throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -98,12 +100,17 @@ public async Task> GetAllAsync(string resourceGr } /// List HCX Enterprise Sites in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -113,7 +120,7 @@ public Response GetAll(string resourceGroupName, string p throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -129,7 +136,7 @@ public Response GetAll(string resourceGroupName, string p } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -152,13 +159,18 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get an HCX Enterprise Site by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the HCX Enterprise Site in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -172,7 +184,7 @@ public async Task> GetAsync(string resourceGroup throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, hcxEnterpriseSiteName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -191,13 +203,18 @@ public async Task> GetAsync(string resourceGroup } /// Get an HCX Enterprise Site by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the HCX Enterprise Site in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -211,7 +228,7 @@ public Response Get(string resourceGroupName, string priv throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, hcxEnterpriseSiteName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -229,7 +246,7 @@ public Response Get(string resourceGroupName, string priv } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -256,14 +273,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Create or update an HCX Enterprise Site in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the HCX Enterprise Site in the private cloud. /// The HCX Enterprise Site. /// The cancellation token to use. - /// , , , or is null. - public async Task> CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -281,7 +303,7 @@ public async Task> CreateOrUpdateAsync(string re throw new ArgumentNullException(nameof(hcxEnterpriseSite)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName, hcxEnterpriseSite); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, hcxEnterpriseSiteName, hcxEnterpriseSite); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -299,14 +321,19 @@ public async Task> CreateOrUpdateAsync(string re } /// Create or update an HCX Enterprise Site in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the HCX Enterprise Site in the private cloud. /// The HCX Enterprise Site. /// The cancellation token to use. - /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, HcxEnterpriseSiteData hcxEnterpriseSite, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -324,7 +351,7 @@ public Response CreateOrUpdate(string resourceGroupName, throw new ArgumentNullException(nameof(hcxEnterpriseSite)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName, hcxEnterpriseSite); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, hcxEnterpriseSiteName, hcxEnterpriseSite); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -341,7 +368,7 @@ public Response CreateOrUpdate(string resourceGroupName, } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -364,13 +391,18 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privat } /// Delete an HCX Enterprise Site in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the HCX Enterprise Site in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -384,7 +416,7 @@ public async Task DeleteAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, hcxEnterpriseSiteName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -397,13 +429,18 @@ public async Task DeleteAsync(string resourceGroupName, string private } /// Delete an HCX Enterprise Site in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the HCX Enterprise Site in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Delete(string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string hcxEnterpriseSiteName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -417,7 +454,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(hcxEnterpriseSiteName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, hcxEnterpriseSiteName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, hcxEnterpriseSiteName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -429,7 +466,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -445,16 +482,21 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List HCX Enterprise Sites in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -464,7 +506,7 @@ public async Task> GetAllNextPageAsync(string ne throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -482,16 +524,21 @@ public async Task> GetAllNextPageAsync(string ne /// List HCX Enterprise Sites in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -501,7 +548,7 @@ public Response GetAllNextPage(string nextLink, string re throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs index c82cd84bc80a..836f121bfb2b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/LocationsRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class LocationsRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class LocationsRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public LocationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public LocationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public LocationsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateCheckTrialAvailabilityRequest(string location) + internal HttpMessage CreateCheckTrialAvailabilityRequest(string subscriptionId, string location) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -64,17 +61,22 @@ internal HttpMessage CreateCheckTrialAvailabilityRequest(string location) } /// Return trial status for subscription by region. + /// The ID of the target subscription. /// Azure region. /// The cancellation token to use. - /// is null. - public async Task> CheckTrialAvailabilityAsync(string location, CancellationToken cancellationToken = default) + /// or is null. + public async Task> CheckTrialAvailabilityAsync(string subscriptionId, string location, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (location == null) { throw new ArgumentNullException(nameof(location)); } - using var message = CreateCheckTrialAvailabilityRequest(location); + using var message = CreateCheckTrialAvailabilityRequest(subscriptionId, location); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -91,17 +93,22 @@ public async Task> CheckTrialAvailabilityAsync(string location, } /// Return trial status for subscription by region. + /// The ID of the target subscription. /// Azure region. /// The cancellation token to use. - /// is null. - public Response CheckTrialAvailability(string location, CancellationToken cancellationToken = default) + /// or is null. + public Response CheckTrialAvailability(string subscriptionId, string location, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (location == null) { throw new ArgumentNullException(nameof(location)); } - using var message = CreateCheckTrialAvailabilityRequest(location); + using var message = CreateCheckTrialAvailabilityRequest(subscriptionId, location); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -117,7 +124,7 @@ public Response CheckTrialAvailability(string location, CancellationToken } } - internal HttpMessage CreateCheckQuotaAvailabilityRequest(string location) + internal HttpMessage CreateCheckQuotaAvailabilityRequest(string subscriptionId, string location) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -137,17 +144,22 @@ internal HttpMessage CreateCheckQuotaAvailabilityRequest(string location) } /// Return quota for subscription by region. + /// The ID of the target subscription. /// Azure region. /// The cancellation token to use. - /// is null. - public async Task> CheckQuotaAvailabilityAsync(string location, CancellationToken cancellationToken = default) + /// or is null. + public async Task> CheckQuotaAvailabilityAsync(string subscriptionId, string location, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (location == null) { throw new ArgumentNullException(nameof(location)); } - using var message = CreateCheckQuotaAvailabilityRequest(location); + using var message = CreateCheckQuotaAvailabilityRequest(subscriptionId, location); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -164,17 +176,22 @@ public async Task> CheckQuotaAvailabilityAsync(string location, } /// Return quota for subscription by region. + /// The ID of the target subscription. /// Azure region. /// The cancellation token to use. - /// is null. - public Response CheckQuotaAvailability(string location, CancellationToken cancellationToken = default) + /// or is null. + public Response CheckQuotaAvailability(string subscriptionId, string location, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (location == null) { throw new ArgumentNullException(nameof(location)); } - using var message = CreateCheckQuotaAvailabilityRequest(location); + using var message = CreateCheckQuotaAvailabilityRequest(subscriptionId, location); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs index 17be6c18b66d..9fce75f3bb19 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PlacementPoliciesRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class PlacementPoliciesRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class PlacementPoliciesRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public PlacementPoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public PlacementPoliciesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public PlacementPoliciesRestOperations(ClientDiagnostics clientDiagnostics, Http _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName, string clusterName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -68,13 +65,18 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List placement policies in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -88,7 +90,7 @@ public async Task> GetAllAsync(string resourceGr throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -105,13 +107,18 @@ public async Task> GetAllAsync(string resourceGr } /// List placement policies in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -125,7 +132,7 @@ public Response GetAll(string resourceGroupName, string p throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -141,7 +148,7 @@ public Response GetAll(string resourceGroupName, string p } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -166,14 +173,19 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get a placement policy by name in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -191,7 +203,7 @@ public async Task> GetAsync(string resourceGroupNa throw new ArgumentNullException(nameof(placementPolicyName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, placementPolicyName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -210,14 +222,19 @@ public async Task> GetAsync(string resourceGroupNa } /// Get a placement policy by name in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. /// The cancellation token to use. - /// , , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -235,7 +252,7 @@ public Response Get(string resourceGroupName, string privat throw new ArgumentNullException(nameof(placementPolicyName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, placementPolicyName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -253,7 +270,7 @@ public Response Get(string resourceGroupName, string privat } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyData placementPolicy) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyData placementPolicy) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -282,15 +299,20 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Create or update a placement policy in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. /// A placement policy in the private cloud cluster. /// The cancellation token to use. - /// , , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyData placementPolicy, CancellationToken cancellationToken = default) + /// , , , , , or is null. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyData placementPolicy, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -312,7 +334,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(placementPolicy)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicy); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicy); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -325,15 +347,20 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } /// Create or update a placement policy in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. /// A placement policy in the private cloud cluster. /// The cancellation token to use. - /// , , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyData placementPolicy, CancellationToken cancellationToken = default) + /// , , , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyData placementPolicy, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -355,7 +382,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(placementPolicy)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicy); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicy); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -367,7 +394,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateUpdateRequest(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyUpdate placementPolicyUpdate) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyUpdate placementPolicyUpdate) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -396,15 +423,20 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string privat } /// Update a placement policy in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. /// The placement policy properties that may be updated. /// The cancellation token to use. - /// , , , , or is null. - public async Task UpdateAsync(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyUpdate placementPolicyUpdate, CancellationToken cancellationToken = default) + /// , , , , , or is null. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyUpdate placementPolicyUpdate, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -426,7 +458,7 @@ public async Task UpdateAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(placementPolicyUpdate)); } - using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicyUpdate); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicyUpdate); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -439,15 +471,20 @@ public async Task UpdateAsync(string resourceGroupName, string private } /// Update a placement policy in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. /// The placement policy properties that may be updated. /// The cancellation token to use. - /// , , , , or is null. - public Response Update(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyUpdate placementPolicyUpdate, CancellationToken cancellationToken = default) + /// , , , , , or is null. + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, PlacementPolicyUpdate placementPolicyUpdate, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -469,7 +506,7 @@ public Response Update(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(placementPolicyUpdate)); } - using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicyUpdate); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, placementPolicyName, placementPolicyUpdate); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -481,7 +518,7 @@ public Response Update(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -506,14 +543,19 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privat } /// Delete a placement policy in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. /// The cancellation token to use. - /// , , , or is null. - public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -531,7 +573,7 @@ public async Task DeleteAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(placementPolicyName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, placementPolicyName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -545,14 +587,19 @@ public async Task DeleteAsync(string resourceGroupName, string private } /// Delete a placement policy in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Name of the VMware vSphere Distributed Resource Scheduler (DRS) placement policy. /// The cancellation token to use. - /// , , , or is null. - public Response Delete(string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string placementPolicyName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -570,7 +617,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(placementPolicyName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, clusterName, placementPolicyName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, placementPolicyName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -583,7 +630,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName, string clusterName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -599,17 +646,22 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List placement policies in a private cloud cluster. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -623,7 +675,7 @@ public async Task> GetAllNextPageAsync(string ne throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName, clusterName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -641,17 +693,22 @@ public async Task> GetAllNextPageAsync(string ne /// List placement policies in a private cloud cluster. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -665,7 +722,7 @@ public Response GetAllNextPage(string nextLink, string re throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName, clusterName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs index 2ab4d7e1291b..8836588e3cdd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/PrivateCloudsRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class PrivateCloudsRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class PrivateCloudsRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public PrivateCloudsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public PrivateCloudsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public PrivateCloudsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipe _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -64,17 +61,22 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName) } /// List private clouds in a resource group. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// is null. - public async Task> GetAllAsync(string resourceGroupName, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - using var message = CreateGetAllRequest(resourceGroupName); + using var message = CreateListRequest(subscriptionId, resourceGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -91,17 +93,22 @@ public async Task> GetAllAsync(string resourceGroupNa } /// List private clouds in a resource group. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// is null. - public Response GetAll(string resourceGroupName, CancellationToken cancellationToken = default) + /// or is null. + public Response List(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - using var message = CreateGetAllRequest(resourceGroupName); + using var message = CreateListRequest(subscriptionId, resourceGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -117,7 +124,7 @@ public Response GetAll(string resourceGroupName, CancellationT } } - internal HttpMessage CreateGetInSubscriptionRequest() + internal HttpMessage CreateListInSubscriptionRequest(string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -135,10 +142,17 @@ internal HttpMessage CreateGetInSubscriptionRequest() } /// List private clouds in a subscription. + /// The ID of the target subscription. /// The cancellation token to use. - public async Task> GetInSubscriptionAsync(CancellationToken cancellationToken = default) + /// is null. + public async Task> ListInSubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) { - using var message = CreateGetInSubscriptionRequest(); + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + + using var message = CreateListInSubscriptionRequest(subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -155,10 +169,17 @@ public async Task> GetInSubscriptionAsync(Cancellatio } /// List private clouds in a subscription. + /// The ID of the target subscription. /// The cancellation token to use. - public Response GetInSubscription(CancellationToken cancellationToken = default) + /// is null. + public Response ListInSubscription(string subscriptionId, CancellationToken cancellationToken = default) { - using var message = CreateGetInSubscriptionRequest(); + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } + + using var message = CreateListInSubscriptionRequest(subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -174,7 +195,7 @@ public Response GetInSubscription(CancellationToken cancellati } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -195,12 +216,17 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -210,7 +236,7 @@ public async Task> GetAsync(string resourceGroupName, throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -229,12 +255,17 @@ public async Task> GetAsync(string resourceGroupName, } /// Get a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response Get(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -244,7 +275,7 @@ public Response Get(string resourceGroupName, string privateCl throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -262,7 +293,7 @@ public Response Get(string resourceGroupName, string privateCl } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, PrivateCloudData privateCloud) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudData privateCloud) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -287,13 +318,18 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Create or update a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, PrivateCloudData privateCloud, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudData privateCloud, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -307,7 +343,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(privateCloud)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, privateCloud); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, privateCloud); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -320,13 +356,18 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } /// Create or update a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The private cloud. /// The cancellation token to use. - /// , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, PrivateCloudData privateCloud, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudData privateCloud, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -340,7 +381,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(privateCloud)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, privateCloud); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, privateCloud); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -352,7 +393,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateUpdateRequest(string resourceGroupName, string privateCloudName, PrivateCloudUpdate privateCloudUpdate) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudUpdate privateCloudUpdate) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -377,13 +418,18 @@ internal HttpMessage CreateUpdateRequest(string resourceGroupName, string privat } /// Update a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The private cloud properties to be updated. /// The cancellation token to use. - /// , , or is null. - public async Task UpdateAsync(string resourceGroupName, string privateCloudName, PrivateCloudUpdate privateCloudUpdate, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudUpdate privateCloudUpdate, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -397,7 +443,7 @@ public async Task UpdateAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(privateCloudUpdate)); } - using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, privateCloudUpdate); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, privateCloudUpdate); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -410,13 +456,18 @@ public async Task UpdateAsync(string resourceGroupName, string private } /// Update a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The private cloud properties to be updated. /// The cancellation token to use. - /// , , or is null. - public Response Update(string resourceGroupName, string privateCloudName, PrivateCloudUpdate privateCloudUpdate, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Update(string subscriptionId, string resourceGroupName, string privateCloudName, PrivateCloudUpdate privateCloudUpdate, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -430,7 +481,7 @@ public Response Update(string resourceGroupName, string privateCloudName, Privat throw new ArgumentNullException(nameof(privateCloudUpdate)); } - using var message = CreateUpdateRequest(resourceGroupName, privateCloudName, privateCloudUpdate); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, privateCloudUpdate); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -442,7 +493,7 @@ public Response Update(string resourceGroupName, string privateCloudName, Privat } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -463,12 +514,17 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privat } /// Delete a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task DeleteAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -478,7 +534,7 @@ public async Task DeleteAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -492,12 +548,17 @@ public async Task DeleteAsync(string resourceGroupName, string private } /// Delete a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response Delete(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -507,7 +568,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, Cancel throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -520,7 +581,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, Cancel } } - internal HttpMessage CreateRotateVcenterPasswordRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateRotateVcenterPasswordRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -542,12 +603,17 @@ internal HttpMessage CreateRotateVcenterPasswordRequest(string resourceGroupName } /// Rotate the vCenter password. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task RotateVcenterPasswordAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task RotateVcenterPasswordAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -557,7 +623,7 @@ public async Task RotateVcenterPasswordAsync(string resourceGroupName, throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateRotateVcenterPasswordRequest(resourceGroupName, privateCloudName); + using var message = CreateRotateVcenterPasswordRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -570,12 +636,17 @@ public async Task RotateVcenterPasswordAsync(string resourceGroupName, } /// Rotate the vCenter password. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response RotateVcenterPassword(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response RotateVcenterPassword(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -585,7 +656,7 @@ public Response RotateVcenterPassword(string resourceGroupName, string privateCl throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateRotateVcenterPasswordRequest(resourceGroupName, privateCloudName); + using var message = CreateRotateVcenterPasswordRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -597,7 +668,7 @@ public Response RotateVcenterPassword(string resourceGroupName, string privateCl } } - internal HttpMessage CreateRotateNsxtPasswordRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateRotateNsxtPasswordRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -619,12 +690,17 @@ internal HttpMessage CreateRotateNsxtPasswordRequest(string resourceGroupName, s } /// Rotate the NSX-T Manager password. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task RotateNsxtPasswordAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task RotateNsxtPasswordAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -634,7 +710,7 @@ public async Task RotateNsxtPasswordAsync(string resourceGroupName, st throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateRotateNsxtPasswordRequest(resourceGroupName, privateCloudName); + using var message = CreateRotateNsxtPasswordRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -647,12 +723,17 @@ public async Task RotateNsxtPasswordAsync(string resourceGroupName, st } /// Rotate the NSX-T Manager password. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response RotateNsxtPassword(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response RotateNsxtPassword(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -662,7 +743,7 @@ public Response RotateNsxtPassword(string resourceGroupName, string privateCloud throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateRotateNsxtPasswordRequest(resourceGroupName, privateCloudName); + using var message = CreateRotateNsxtPasswordRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -674,7 +755,7 @@ public Response RotateNsxtPassword(string resourceGroupName, string privateCloud } } - internal HttpMessage CreateGetAdminCredentialsRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListAdminCredentialsRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -696,12 +777,17 @@ internal HttpMessage CreateGetAdminCredentialsRequest(string resourceGroupName, } /// List the admin credentials for the private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetAdminCredentialsAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListAdminCredentialsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -711,7 +797,7 @@ public async Task> GetAdminCredentialsAsync(string re throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAdminCredentialsRequest(resourceGroupName, privateCloudName); + using var message = CreateListAdminCredentialsRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -728,12 +814,17 @@ public async Task> GetAdminCredentialsAsync(string re } /// List the admin credentials for the private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetAdminCredentials(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListAdminCredentials(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -743,7 +834,7 @@ public Response GetAdminCredentials(string resourceGroupName, throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAdminCredentialsRequest(resourceGroupName, privateCloudName); + using var message = CreateListAdminCredentialsRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -759,7 +850,7 @@ public Response GetAdminCredentials(string resourceGroupName, } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -775,21 +866,26 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List private clouds in a resource group. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -807,21 +903,26 @@ public async Task> GetAllNextPageAsync(string nextLin /// List private clouds in a resource group. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. - /// or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -837,7 +938,7 @@ public Response GetAllNextPage(string nextLink, string resourc } } - internal HttpMessage CreateGetInSubscriptionNextPageRequest(string nextLink) + internal HttpMessage CreateListInSubscriptionNextPageRequest(string nextLink, string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -853,16 +954,21 @@ internal HttpMessage CreateGetInSubscriptionNextPageRequest(string nextLink) /// List private clouds in a subscription. /// The URL to the next page of results. + /// The ID of the target subscription. /// The cancellation token to use. - /// is null. - public async Task> GetInSubscriptionNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + /// or is null. + public async Task> ListInSubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } - using var message = CreateGetInSubscriptionNextPageRequest(nextLink); + using var message = CreateListInSubscriptionNextPageRequest(nextLink, subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -880,16 +986,21 @@ public async Task> GetInSubscriptionNextPageAsync(str /// List private clouds in a subscription. /// The URL to the next page of results. + /// The ID of the target subscription. /// The cancellation token to use. - /// is null. - public Response GetInSubscriptionNextPage(string nextLink, CancellationToken cancellationToken = default) + /// or is null. + public Response ListInSubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } - using var message = CreateGetInSubscriptionNextPageRequest(nextLink); + using var message = CreateListInSubscriptionNextPageRequest(nextLink, subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs index cf914d23ea9e..2fc727457bcd 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptCmdletsRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class ScriptCmdletsRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class ScriptCmdletsRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public ScriptCmdletsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public ScriptCmdletsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public ScriptCmdletsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipe _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName, string scriptPackageName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -68,13 +65,18 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the script package in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -88,7 +90,7 @@ public async Task> GetAllAsync(string resourceGroupN throw new ArgumentNullException(nameof(scriptPackageName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, scriptPackageName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName, scriptPackageName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -105,13 +107,18 @@ public async Task> GetAllAsync(string resourceGroupN } /// List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the script package in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -125,7 +132,7 @@ public Response GetAll(string resourceGroupName, string priva throw new ArgumentNullException(nameof(scriptPackageName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, scriptPackageName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName, scriptPackageName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -141,7 +148,7 @@ public Response GetAll(string resourceGroupName, string priva } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -166,14 +173,19 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Return information about a script cmdlet resource in a specific package on a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the script package in the private cloud. /// Name of the script cmdlet resource in the script package in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -191,31 +203,38 @@ public async Task> GetAsync(string resourceGroupName, str throw new ArgumentNullException(nameof(scriptCmdletName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptPackageName, scriptCmdletName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, scriptPackageName, scriptCmdletName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ScriptCmdlet value = default; + ScriptCmdletData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ScriptCmdlet.DeserializeScriptCmdlet(document.RootElement); + value = ScriptCmdletData.DeserializeScriptCmdletData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScriptCmdletData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Return information about a script cmdlet resource in a specific package on a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the script package in the private cloud. /// Name of the script cmdlet resource in the script package in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -233,23 +252,25 @@ public Response Get(string resourceGroupName, string privateCloudN throw new ArgumentNullException(nameof(scriptCmdletName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptPackageName, scriptCmdletName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, scriptPackageName, scriptCmdletName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ScriptCmdlet value = default; + ScriptCmdletData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ScriptCmdlet.DeserializeScriptCmdlet(document.RootElement); + value = ScriptCmdletData.DeserializeScriptCmdletData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScriptCmdletData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName, string scriptPackageName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -265,17 +286,22 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the script package in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -289,7 +315,7 @@ public async Task> GetAllNextPageAsync(string nextLi throw new ArgumentNullException(nameof(scriptPackageName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, scriptPackageName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName, scriptPackageName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -307,17 +333,22 @@ public async Task> GetAllNextPageAsync(string nextLi /// List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the script package in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -331,7 +362,7 @@ public Response GetAllNextPage(string nextLink, string resour throw new ArgumentNullException(nameof(scriptPackageName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, scriptPackageName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName, scriptPackageName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs index 6b29ff1d2814..c2b7057331ca 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptExecutionsRestOperations.cs @@ -20,7 +20,6 @@ namespace Azure.ResourceManager.Avs { internal partial class ScriptExecutionsRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -31,13 +30,11 @@ internal partial class ScriptExecutionsRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public ScriptExecutionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public ScriptExecutionsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -45,7 +42,7 @@ public ScriptExecutionsRestOperations(ClientDiagnostics clientDiagnostics, HttpP _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -67,12 +64,17 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List script executions in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -82,7 +84,7 @@ public async Task> GetAllAsync(string resourceGro throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -99,12 +101,17 @@ public async Task> GetAllAsync(string resourceGro } /// List script executions in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -114,7 +121,7 @@ public Response GetAll(string resourceGroupName, string pr throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -130,7 +137,7 @@ public Response GetAll(string resourceGroupName, string pr } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string scriptExecutionName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -153,13 +160,18 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get an script execution by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the user-invoked script execution resource. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -173,30 +185,37 @@ public async Task> GetAsync(string resourceGroupName, throw new ArgumentNullException(nameof(scriptExecutionName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptExecutionName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, scriptExecutionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ScriptExecution value = default; + ScriptExecutionData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ScriptExecution.DeserializeScriptExecution(document.RootElement); + value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScriptExecutionData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get an script execution by name in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the user-invoked script execution resource. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -210,23 +229,25 @@ public Response Get(string resourceGroupName, string privateClo throw new ArgumentNullException(nameof(scriptExecutionName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptExecutionName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, scriptExecutionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ScriptExecution value = default; + ScriptExecutionData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ScriptExecution.DeserializeScriptExecution(document.RootElement); + value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScriptExecutionData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecution scriptExecution) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecutionData scriptExecution) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -253,14 +274,19 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, strin } /// Create or update a script execution in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the user-invoked script execution resource. /// A script running in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateOrUpdateAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecution scriptExecution, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecutionData scriptExecution, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -278,7 +304,7 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(scriptExecution)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, scriptExecutionName, scriptExecution); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, scriptExecutionName, scriptExecution); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -291,14 +317,19 @@ public async Task CreateOrUpdateAsync(string resourceGroupName, string } /// Create or update a script execution in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the private cloud. /// Name of the user-invoked script execution resource. /// A script running in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public Response CreateOrUpdate(string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecution scriptExecution, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName, ScriptExecutionData scriptExecution, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -316,7 +347,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(scriptExecution)); } - using var message = CreateCreateOrUpdateRequest(resourceGroupName, privateCloudName, scriptExecutionName, scriptExecution); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, privateCloudName, scriptExecutionName, scriptExecution); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -328,7 +359,7 @@ public Response CreateOrUpdate(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privateCloudName, string scriptExecutionName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -351,13 +382,18 @@ internal HttpMessage CreateDeleteRequest(string resourceGroupName, string privat } /// Cancel a ScriptExecution in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the user-invoked script execution resource. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -371,7 +407,7 @@ public async Task DeleteAsync(string resourceGroupName, string private throw new ArgumentNullException(nameof(scriptExecutionName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, scriptExecutionName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, scriptExecutionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -385,13 +421,18 @@ public async Task DeleteAsync(string resourceGroupName, string private } /// Cancel a ScriptExecution in a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the user-invoked script execution resource. /// The cancellation token to use. - /// , , or is null. - public Response Delete(string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Delete(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -405,7 +446,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string throw new ArgumentNullException(nameof(scriptExecutionName)); } - using var message = CreateDeleteRequest(resourceGroupName, privateCloudName, scriptExecutionName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, privateCloudName, scriptExecutionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -418,7 +459,7 @@ public Response Delete(string resourceGroupName, string privateCloudName, string } } - internal HttpMessage CreateGetExecutionLogsRequest(string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType) + internal HttpMessage CreateGetExecutionLogsRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -454,14 +495,19 @@ internal HttpMessage CreateGetExecutionLogsRequest(string resourceGroupName, str } /// Return the logs for a script execution resource. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the user-invoked script execution resource. /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. /// The cancellation token to use. - /// , , or is null. - public async Task> GetExecutionLogsAsync(string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetExecutionLogsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -475,15 +521,15 @@ public async Task> GetExecutionLogsAsync(string resour throw new ArgumentNullException(nameof(scriptExecutionName)); } - using var message = CreateGetExecutionLogsRequest(resourceGroupName, privateCloudName, scriptExecutionName, scriptOutputStreamType); + using var message = CreateGetExecutionLogsRequest(subscriptionId, resourceGroupName, privateCloudName, scriptExecutionName, scriptOutputStreamType); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ScriptExecution value = default; + ScriptExecutionData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ScriptExecution.DeserializeScriptExecution(document.RootElement); + value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -492,14 +538,19 @@ public async Task> GetExecutionLogsAsync(string resour } /// Return the logs for a script execution resource. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the user-invoked script execution resource. /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. /// The cancellation token to use. - /// , , or is null. - public Response GetExecutionLogs(string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response GetExecutionLogs(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName, IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -513,15 +564,15 @@ public Response GetExecutionLogs(string resourceGroupName, stri throw new ArgumentNullException(nameof(scriptExecutionName)); } - using var message = CreateGetExecutionLogsRequest(resourceGroupName, privateCloudName, scriptExecutionName, scriptOutputStreamType); + using var message = CreateGetExecutionLogsRequest(subscriptionId, resourceGroupName, privateCloudName, scriptExecutionName, scriptOutputStreamType); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ScriptExecution value = default; + ScriptExecutionData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ScriptExecution.DeserializeScriptExecution(document.RootElement); + value = ScriptExecutionData.DeserializeScriptExecutionData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -529,7 +580,7 @@ public Response GetExecutionLogs(string resourceGroupName, stri } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -545,16 +596,21 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List script executions in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -564,7 +620,7 @@ public async Task> GetAllNextPageAsync(string nex throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -582,16 +638,21 @@ public async Task> GetAllNextPageAsync(string nex /// List script executions in a private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -601,7 +662,7 @@ public Response GetAllNextPage(string nextLink, string res throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs index 13e1415d5364..decb3ea74bb7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/ScriptPackagesRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class ScriptPackagesRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class ScriptPackagesRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public ScriptPackagesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public ScriptPackagesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public ScriptPackagesRestOperations(ClientDiagnostics clientDiagnostics, HttpPip _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -66,12 +63,17 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List script packages available to run on the private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -81,7 +83,7 @@ public async Task> GetAllAsync(string resourceGroup throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -98,12 +100,17 @@ public async Task> GetAllAsync(string resourceGroup } /// List script packages available to run on the private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -113,7 +120,7 @@ public Response GetAll(string resourceGroupName, string priv throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -129,7 +136,7 @@ public Response GetAll(string resourceGroupName, string priv } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string scriptPackageName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -152,13 +159,18 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get a script package available to run on a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the script package in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -172,30 +184,37 @@ public async Task> GetAsync(string resourceGroupName, st throw new ArgumentNullException(nameof(scriptPackageName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptPackageName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, scriptPackageName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ScriptPackage value = default; + ScriptPackageData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ScriptPackage.DeserializeScriptPackage(document.RootElement); + value = ScriptPackageData.DeserializeScriptPackageData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScriptPackageData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get a script package available to run on a private cloud. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the script package in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -209,23 +228,25 @@ public Response Get(string resourceGroupName, string privateCloud throw new ArgumentNullException(nameof(scriptPackageName)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, scriptPackageName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, scriptPackageName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ScriptPackage value = default; + ScriptPackageData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ScriptPackage.DeserializeScriptPackage(document.RootElement); + value = ScriptPackageData.DeserializeScriptPackageData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((ScriptPackageData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -241,16 +262,21 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List script packages available to run on the private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -260,7 +286,7 @@ public async Task> GetAllNextPageAsync(string nextL throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -278,16 +304,21 @@ public async Task> GetAllNextPageAsync(string nextL /// List script packages available to run on the private cloud. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -297,7 +328,7 @@ public Response GetAllNextPage(string nextLink, string resou throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs index 63b9e4a1c254..107cd7a73f0b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/VirtualMachinesRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class VirtualMachinesRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class VirtualMachinesRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public VirtualMachinesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public VirtualMachinesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public VirtualMachinesRestOperations(ClientDiagnostics clientDiagnostics, HttpPi _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privateCloudName, string clusterName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -68,13 +65,18 @@ internal HttpMessage CreateGetAllRequest(string resourceGroupName, string privat } /// List of virtual machines in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetAllAsync(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -88,7 +90,7 @@ public async Task> GetAllAsync(string resourceGrou throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -105,13 +107,18 @@ public async Task> GetAllAsync(string resourceGrou } /// List of virtual machines in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetAll(string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response List(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -125,7 +132,7 @@ public Response GetAll(string resourceGroupName, string pri throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllRequest(resourceGroupName, privateCloudName, clusterName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -141,7 +148,7 @@ public Response GetAll(string resourceGroupName, string pri } } - internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -166,14 +173,19 @@ internal HttpMessage CreateGetRequest(string resourceGroupName, string privateCl } /// Get a virtual machine by id in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Virtual Machine identifier. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAsync(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -191,31 +203,38 @@ public async Task> GetAsync(string resourceGroupName, s throw new ArgumentNullException(nameof(virtualMachineId)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, virtualMachineId); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, virtualMachineId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - VirtualMachine value = default; + VirtualMachineData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = VirtualMachine.DeserializeVirtualMachine(document.RootElement); + value = VirtualMachineData.DeserializeVirtualMachineData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((VirtualMachineData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get a virtual machine by id in a private cloud cluster. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Virtual Machine identifier. /// The cancellation token to use. - /// , , , or is null. - public Response Get(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response Get(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -233,23 +252,25 @@ public Response Get(string resourceGroupName, string privateClou throw new ArgumentNullException(nameof(virtualMachineId)); } - using var message = CreateGetRequest(resourceGroupName, privateCloudName, clusterName, virtualMachineId); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, virtualMachineId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - VirtualMachine value = default; + VirtualMachineData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = VirtualMachine.DeserializeVirtualMachine(document.RootElement); + value = VirtualMachineData.DeserializeVirtualMachineData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((VirtualMachineData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateRestrictMovementRequest(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement) + internal HttpMessage CreateRestrictMovementRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -279,15 +300,20 @@ internal HttpMessage CreateRestrictMovementRequest(string resourceGroupName, str } /// Enable or disable DRS-driven VM movement restriction. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Virtual Machine identifier. /// Whether VM DRS-driven movement is restricted (Enabled) or not (Disabled). /// The cancellation token to use. - /// , , , , or is null. - public async Task RestrictMovementAsync(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) + /// , , , , , or is null. + public async Task RestrictMovementAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -309,7 +335,7 @@ public async Task RestrictMovementAsync(string resourceGroupName, stri throw new ArgumentNullException(nameof(restrictMovement)); } - using var message = CreateRestrictMovementRequest(resourceGroupName, privateCloudName, clusterName, virtualMachineId, restrictMovement); + using var message = CreateRestrictMovementRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, virtualMachineId, restrictMovement); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -321,15 +347,20 @@ public async Task RestrictMovementAsync(string resourceGroupName, stri } /// Enable or disable DRS-driven VM movement restriction. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// Virtual Machine identifier. /// Whether VM DRS-driven movement is restricted (Enabled) or not (Disabled). /// The cancellation token to use. - /// , , , , or is null. - public Response RestrictMovement(string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) + /// , , , , , or is null. + public Response RestrictMovement(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -351,7 +382,7 @@ public Response RestrictMovement(string resourceGroupName, string privateCloudNa throw new ArgumentNullException(nameof(restrictMovement)); } - using var message = CreateRestrictMovementRequest(resourceGroupName, privateCloudName, clusterName, virtualMachineId, restrictMovement); + using var message = CreateRestrictMovementRequest(subscriptionId, resourceGroupName, privateCloudName, clusterName, virtualMachineId, restrictMovement); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -362,7 +393,7 @@ public Response RestrictMovement(string resourceGroupName, string privateCloudNa } } - internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName, string clusterName) + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -378,17 +409,22 @@ internal HttpMessage CreateGetAllNextPageRequest(string nextLink, string resourc /// List of virtual machines in a private cloud cluster. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public async Task> GetAllNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -402,7 +438,7 @@ public async Task> GetAllNextPageAsync(string next throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName, clusterName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -420,17 +456,22 @@ public async Task> GetAllNextPageAsync(string next /// List of virtual machines in a private cloud cluster. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Name of the cluster in the private cloud. /// The cancellation token to use. - /// , , , or is null. - public Response GetAllNextPage(string nextLink, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -444,7 +485,7 @@ public Response GetAllNextPage(string nextLink, string reso throw new ArgumentNullException(nameof(clusterName)); } - using var message = CreateGetAllNextPageRequest(nextLink, resourceGroupName, privateCloudName, clusterName); + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName, clusterName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs index 62721d0173a7..8cdb254862a8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/RestOperations/WorkloadNetworksRestOperations.cs @@ -19,7 +19,6 @@ namespace Azure.ResourceManager.Avs { internal partial class WorkloadNetworksRestOperations { - private string subscriptionId; private Uri endpoint; private string apiVersion; private ClientDiagnostics _clientDiagnostics; @@ -30,13 +29,11 @@ internal partial class WorkloadNetworksRestOperations /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The client options used to construct the current client. - /// The ID of the target subscription. /// server parameter. /// Api Version. - /// or is null. - public WorkloadNetworksRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, string subscriptionId, Uri endpoint = null, string apiVersion = "2021-12-01") + /// is null. + public WorkloadNetworksRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, ClientOptions options, Uri endpoint = null, string apiVersion = "2021-12-01") { - this.subscriptionId = subscriptionId ?? throw new ArgumentNullException(nameof(subscriptionId)); this.endpoint = endpoint ?? new Uri("https://management.azure.com"); this.apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); _clientDiagnostics = clientDiagnostics; @@ -44,7 +41,7 @@ public WorkloadNetworksRestOperations(ClientDiagnostics clientDiagnostics, HttpP _userAgent = HttpMessageUtilities.GetUserAgentName(this, options); } - internal HttpMessage CreateGetSegmentsRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListSegmentsRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -66,12 +63,17 @@ internal HttpMessage CreateGetSegmentsRequest(string resourceGroupName, string p } /// List of segments in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetSegmentsAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListSegmentsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -81,7 +83,7 @@ public async Task> GetSegmentsAsync(string throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetSegmentsRequest(resourceGroupName, privateCloudName); + using var message = CreateListSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -98,12 +100,17 @@ public async Task> GetSegmentsAsync(string } /// List of segments in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetSegments(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListSegments(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -113,7 +120,7 @@ public Response GetSegments(string resourceGroupNam throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetSegmentsRequest(resourceGroupName, privateCloudName); + using var message = CreateListSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -129,7 +136,7 @@ public Response GetSegments(string resourceGroupNam } } - internal HttpMessage CreateGetSegmentRequest(string resourceGroupName, string privateCloudName, string segmentId) + internal HttpMessage CreateGetSegmentRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -152,13 +159,18 @@ internal HttpMessage CreateGetSegmentRequest(string resourceGroupName, string pr } /// Get a segment by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Segment identifier. Generally the same as the Segment's display name. /// The cancellation token to use. - /// , , or is null. - public async Task> GetSegmentAsync(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetSegmentAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -172,30 +184,37 @@ public async Task> GetSegmentAsync(string resou throw new ArgumentNullException(nameof(segmentId)); } - using var message = CreateGetSegmentRequest(resourceGroupName, privateCloudName, segmentId); + using var message = CreateGetSegmentRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkSegment value = default; + WorkloadNetworkSegmentData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); + value = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkSegmentData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get a segment by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Segment identifier. Generally the same as the Segment's display name. /// The cancellation token to use. - /// , , or is null. - public Response GetSegment(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response GetSegment(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -209,23 +228,25 @@ public Response GetSegment(string resourceGroupName, str throw new ArgumentNullException(nameof(segmentId)); } - using var message = CreateGetSegmentRequest(resourceGroupName, privateCloudName, segmentId); + using var message = CreateGetSegmentRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkSegment value = default; + WorkloadNetworkSegmentData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = WorkloadNetworkSegment.DeserializeWorkloadNetworkSegment(document.RootElement); + value = WorkloadNetworkSegmentData.DeserializeWorkloadNetworkSegmentData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkSegmentData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreateSegmentsRequest(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment) + internal HttpMessage CreateCreateSegmentsRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -252,14 +273,19 @@ internal HttpMessage CreateCreateSegmentsRequest(string resourceGroupName, strin } /// Create a segment by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Segment identifier. Generally the same as the Segment's display name. /// NSX Segment. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateSegmentsAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateSegmentsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -277,7 +303,7 @@ public async Task CreateSegmentsAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(workloadNetworkSegment)); } - using var message = CreateCreateSegmentsRequest(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); + using var message = CreateCreateSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -290,14 +316,19 @@ public async Task CreateSegmentsAsync(string resourceGroupName, string } /// Create a segment by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Segment identifier. Generally the same as the Segment's display name. /// NSX Segment. /// The cancellation token to use. - /// , , , or is null. - public Response CreateSegments(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateSegments(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -315,7 +346,7 @@ public Response CreateSegments(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(workloadNetworkSegment)); } - using var message = CreateCreateSegmentsRequest(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); + using var message = CreateCreateSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -327,7 +358,7 @@ public Response CreateSegments(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateUpdateSegmentsRequest(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment) + internal HttpMessage CreateUpdateSegmentsRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -354,14 +385,19 @@ internal HttpMessage CreateUpdateSegmentsRequest(string resourceGroupName, strin } /// Create or update a segment by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Segment identifier. Generally the same as the Segment's display name. /// NSX Segment. /// The cancellation token to use. - /// , , , or is null. - public async Task UpdateSegmentsAsync(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task UpdateSegmentsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -379,7 +415,7 @@ public async Task UpdateSegmentsAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(workloadNetworkSegment)); } - using var message = CreateUpdateSegmentsRequest(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); + using var message = CreateUpdateSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -392,14 +428,19 @@ public async Task UpdateSegmentsAsync(string resourceGroupName, string } /// Create or update a segment by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Segment identifier. Generally the same as the Segment's display name. /// NSX Segment. /// The cancellation token to use. - /// , , , or is null. - public Response UpdateSegments(string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegment workloadNetworkSegment, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response UpdateSegments(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -417,7 +458,7 @@ public Response UpdateSegments(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(workloadNetworkSegment)); } - using var message = CreateUpdateSegmentsRequest(resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); + using var message = CreateUpdateSegmentsRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId, workloadNetworkSegment); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -429,7 +470,7 @@ public Response UpdateSegments(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateDeleteSegmentRequest(string resourceGroupName, string privateCloudName, string segmentId) + internal HttpMessage CreateDeleteSegmentRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -452,13 +493,18 @@ internal HttpMessage CreateDeleteSegmentRequest(string resourceGroupName, string } /// Delete a segment by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Segment identifier. Generally the same as the Segment's display name. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteSegmentAsync(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteSegmentAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -472,7 +518,7 @@ public async Task DeleteSegmentAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(segmentId)); } - using var message = CreateDeleteSegmentRequest(resourceGroupName, privateCloudName, segmentId); + using var message = CreateDeleteSegmentRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -486,13 +532,18 @@ public async Task DeleteSegmentAsync(string resourceGroupName, string } /// Delete a segment by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Segment identifier. Generally the same as the Segment's display name. /// The cancellation token to use. - /// , , or is null. - public Response DeleteSegment(string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response DeleteSegment(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -506,7 +557,7 @@ public Response DeleteSegment(string resourceGroupName, string privateCloudName, throw new ArgumentNullException(nameof(segmentId)); } - using var message = CreateDeleteSegmentRequest(resourceGroupName, privateCloudName, segmentId); + using var message = CreateDeleteSegmentRequest(subscriptionId, resourceGroupName, privateCloudName, segmentId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -519,7 +570,7 @@ public Response DeleteSegment(string resourceGroupName, string privateCloudName, } } - internal HttpMessage CreateGetDhcpRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListDhcpRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -541,12 +592,17 @@ internal HttpMessage CreateGetDhcpRequest(string resourceGroupName, string priva } /// List dhcp in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetDhcpAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListDhcpAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -556,7 +612,7 @@ public async Task> GetDhcpAsync(string resourc throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDhcpRequest(resourceGroupName, privateCloudName); + using var message = CreateListDhcpRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -573,12 +629,17 @@ public async Task> GetDhcpAsync(string resourc } /// List dhcp in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetDhcp(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListDhcp(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -588,7 +649,7 @@ public Response GetDhcp(string resourceGroupName, strin throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDhcpRequest(resourceGroupName, privateCloudName); + using var message = CreateListDhcpRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -604,7 +665,7 @@ public Response GetDhcp(string resourceGroupName, strin } } - internal HttpMessage CreateGetDhcpRequest(string resourceGroupName, string privateCloudName, string dhcpId) + internal HttpMessage CreateGetDhcpRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -627,13 +688,18 @@ internal HttpMessage CreateGetDhcpRequest(string resourceGroupName, string priva } /// Get dhcp by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DHCP identifier. Generally the same as the DHCP display name. /// The cancellation token to use. - /// , , or is null. - public async Task> GetDhcpAsync(string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetDhcpAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -647,30 +713,37 @@ public async Task> GetDhcpAsync(string resourceGro throw new ArgumentNullException(nameof(dhcpId)); } - using var message = CreateGetDhcpRequest(resourceGroupName, privateCloudName, dhcpId); + using var message = CreateGetDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkDhcp value = default; + WorkloadNetworkDhcpData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + value = WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkDhcpData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get dhcp by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DHCP identifier. Generally the same as the DHCP display name. /// The cancellation token to use. - /// , , or is null. - public Response GetDhcp(string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response GetDhcp(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -684,23 +757,25 @@ public Response GetDhcp(string resourceGroupName, string pr throw new ArgumentNullException(nameof(dhcpId)); } - using var message = CreateGetDhcpRequest(resourceGroupName, privateCloudName, dhcpId); + using var message = CreateGetDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkDhcp value = default; + WorkloadNetworkDhcpData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = WorkloadNetworkDhcp.DeserializeWorkloadNetworkDhcp(document.RootElement); + value = WorkloadNetworkDhcpData.DeserializeWorkloadNetworkDhcpData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkDhcpData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreateDhcpRequest(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + internal HttpMessage CreateCreateDhcpRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData workloadNetworkDhcp) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -727,14 +802,19 @@ internal HttpMessage CreateCreateDhcpRequest(string resourceGroupName, string pr } /// Create dhcp by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DHCP identifier. Generally the same as the DHCP display name. /// NSX DHCP. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateDhcpAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateDhcpAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData workloadNetworkDhcp, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -752,7 +832,7 @@ public async Task CreateDhcpAsync(string resourceGroupName, string pri throw new ArgumentNullException(nameof(workloadNetworkDhcp)); } - using var message = CreateCreateDhcpRequest(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + using var message = CreateCreateDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -765,14 +845,19 @@ public async Task CreateDhcpAsync(string resourceGroupName, string pri } /// Create dhcp by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DHCP identifier. Generally the same as the DHCP display name. /// NSX DHCP. /// The cancellation token to use. - /// , , , or is null. - public Response CreateDhcp(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateDhcp(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData workloadNetworkDhcp, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -790,7 +875,7 @@ public Response CreateDhcp(string resourceGroupName, string privateCloudName, st throw new ArgumentNullException(nameof(workloadNetworkDhcp)); } - using var message = CreateCreateDhcpRequest(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + using var message = CreateCreateDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -802,7 +887,7 @@ public Response CreateDhcp(string resourceGroupName, string privateCloudName, st } } - internal HttpMessage CreateUpdateDhcpRequest(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp) + internal HttpMessage CreateUpdateDhcpRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData workloadNetworkDhcp) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -829,14 +914,19 @@ internal HttpMessage CreateUpdateDhcpRequest(string resourceGroupName, string pr } /// Create or update dhcp by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DHCP identifier. Generally the same as the DHCP display name. /// NSX DHCP. /// The cancellation token to use. - /// , , , or is null. - public async Task UpdateDhcpAsync(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task UpdateDhcpAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData workloadNetworkDhcp, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -854,7 +944,7 @@ public async Task UpdateDhcpAsync(string resourceGroupName, string pri throw new ArgumentNullException(nameof(workloadNetworkDhcp)); } - using var message = CreateUpdateDhcpRequest(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + using var message = CreateUpdateDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -867,14 +957,19 @@ public async Task UpdateDhcpAsync(string resourceGroupName, string pri } /// Create or update dhcp by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DHCP identifier. Generally the same as the DHCP display name. /// NSX DHCP. /// The cancellation token to use. - /// , , , or is null. - public Response UpdateDhcp(string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcp workloadNetworkDhcp, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response UpdateDhcp(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, WorkloadNetworkDhcpData workloadNetworkDhcp, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -892,7 +987,7 @@ public Response UpdateDhcp(string resourceGroupName, string privateCloudName, st throw new ArgumentNullException(nameof(workloadNetworkDhcp)); } - using var message = CreateUpdateDhcpRequest(resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); + using var message = CreateUpdateDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId, workloadNetworkDhcp); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -904,7 +999,7 @@ public Response UpdateDhcp(string resourceGroupName, string privateCloudName, st } } - internal HttpMessage CreateDeleteDhcpRequest(string resourceGroupName, string privateCloudName, string dhcpId) + internal HttpMessage CreateDeleteDhcpRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -927,13 +1022,18 @@ internal HttpMessage CreateDeleteDhcpRequest(string resourceGroupName, string pr } /// Delete dhcp by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DHCP identifier. Generally the same as the DHCP display name. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteDhcpAsync(string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteDhcpAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -947,7 +1047,7 @@ public async Task DeleteDhcpAsync(string resourceGroupName, string pri throw new ArgumentNullException(nameof(dhcpId)); } - using var message = CreateDeleteDhcpRequest(resourceGroupName, privateCloudName, dhcpId); + using var message = CreateDeleteDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -961,13 +1061,18 @@ public async Task DeleteDhcpAsync(string resourceGroupName, string pri } /// Delete dhcp by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DHCP identifier. Generally the same as the DHCP display name. /// The cancellation token to use. - /// , , or is null. - public Response DeleteDhcp(string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response DeleteDhcp(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -981,7 +1086,7 @@ public Response DeleteDhcp(string resourceGroupName, string privateCloudName, st throw new ArgumentNullException(nameof(dhcpId)); } - using var message = CreateDeleteDhcpRequest(resourceGroupName, privateCloudName, dhcpId); + using var message = CreateDeleteDhcpRequest(subscriptionId, resourceGroupName, privateCloudName, dhcpId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -994,7 +1099,7 @@ public Response DeleteDhcp(string resourceGroupName, string privateCloudName, st } } - internal HttpMessage CreateGetGatewaysRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListGatewaysRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1016,12 +1121,17 @@ internal HttpMessage CreateGetGatewaysRequest(string resourceGroupName, string p } /// List of gateways in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetGatewaysAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListGatewaysAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1031,7 +1141,7 @@ public async Task> GetGatewaysAsync(string throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetGatewaysRequest(resourceGroupName, privateCloudName); + using var message = CreateListGatewaysRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1048,12 +1158,17 @@ public async Task> GetGatewaysAsync(string } /// List of gateways in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetGateways(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListGateways(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1063,7 +1178,7 @@ public Response GetGateways(string resourceGroupName throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetGatewaysRequest(resourceGroupName, privateCloudName); + using var message = CreateListGatewaysRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1079,7 +1194,7 @@ public Response GetGateways(string resourceGroupName } } - internal HttpMessage CreateGetGatewayRequest(string resourceGroupName, string privateCloudName, string gatewayId) + internal HttpMessage CreateGetGatewayRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1102,13 +1217,18 @@ internal HttpMessage CreateGetGatewayRequest(string resourceGroupName, string pr } /// Get a gateway by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Gateway identifier. Generally the same as the Gateway's display name. /// The cancellation token to use. - /// , , or is null. - public async Task> GetGatewayAsync(string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetGatewayAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1122,30 +1242,37 @@ public async Task> GetGatewayAsync(string resou throw new ArgumentNullException(nameof(gatewayId)); } - using var message = CreateGetGatewayRequest(resourceGroupName, privateCloudName, gatewayId); + using var message = CreateGetGatewayRequest(subscriptionId, resourceGroupName, privateCloudName, gatewayId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkGateway value = default; + WorkloadNetworkGatewayData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkGateway.DeserializeWorkloadNetworkGateway(document.RootElement); + value = WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkGatewayData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get a gateway by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Gateway identifier. Generally the same as the Gateway's display name. /// The cancellation token to use. - /// , , or is null. - public Response GetGateway(string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response GetGateway(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1159,23 +1286,25 @@ public Response GetGateway(string resourceGroupName, str throw new ArgumentNullException(nameof(gatewayId)); } - using var message = CreateGetGatewayRequest(resourceGroupName, privateCloudName, gatewayId); + using var message = CreateGetGatewayRequest(subscriptionId, resourceGroupName, privateCloudName, gatewayId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkGateway value = default; + WorkloadNetworkGatewayData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = WorkloadNetworkGateway.DeserializeWorkloadNetworkGateway(document.RootElement); + value = WorkloadNetworkGatewayData.DeserializeWorkloadNetworkGatewayData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkGatewayData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateGetPortMirroringRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListPortMirroringRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1197,12 +1326,17 @@ internal HttpMessage CreateGetPortMirroringRequest(string resourceGroupName, str } /// List of port mirroring profiles in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetPortMirroringAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListPortMirroringAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1212,7 +1346,7 @@ public async Task> GetPortMirroringAs throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetPortMirroringRequest(resourceGroupName, privateCloudName); + using var message = CreateListPortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1229,12 +1363,17 @@ public async Task> GetPortMirroringAs } /// List of port mirroring profiles in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetPortMirroring(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListPortMirroring(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1244,7 +1383,7 @@ public Response GetPortMirroring(string resour throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetPortMirroringRequest(resourceGroupName, privateCloudName); + using var message = CreateListPortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1260,7 +1399,7 @@ public Response GetPortMirroring(string resour } } - internal HttpMessage CreateGetPortMirroringRequest(string resourceGroupName, string privateCloudName, string portMirroringId) + internal HttpMessage CreateGetPortMirroringRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1283,13 +1422,18 @@ internal HttpMessage CreateGetPortMirroringRequest(string resourceGroupName, str } /// Get a port mirroring profile by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. /// The cancellation token to use. - /// , , or is null. - public async Task> GetPortMirroringAsync(string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetPortMirroringAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1303,30 +1447,37 @@ public async Task> GetPortMirroringAsync( throw new ArgumentNullException(nameof(portMirroringId)); } - using var message = CreateGetPortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId); + using var message = CreateGetPortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkPortMirroring value = default; + WorkloadNetworkPortMirroringData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + value = WorkloadNetworkPortMirroringData.DeserializeWorkloadNetworkPortMirroringData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkPortMirroringData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get a port mirroring profile by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. /// The cancellation token to use. - /// , , or is null. - public Response GetPortMirroring(string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response GetPortMirroring(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1340,23 +1491,25 @@ public Response GetPortMirroring(string resourceGr throw new ArgumentNullException(nameof(portMirroringId)); } - using var message = CreateGetPortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId); + using var message = CreateGetPortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkPortMirroring value = default; + WorkloadNetworkPortMirroringData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = WorkloadNetworkPortMirroring.DeserializeWorkloadNetworkPortMirroring(document.RootElement); + value = WorkloadNetworkPortMirroringData.DeserializeWorkloadNetworkPortMirroringData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkPortMirroringData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreatePortMirroringRequest(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + internal HttpMessage CreateCreatePortMirroringRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringData workloadNetworkPortMirroring) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1383,14 +1536,19 @@ internal HttpMessage CreateCreatePortMirroringRequest(string resourceGroupName, } /// Create a port mirroring profile by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. /// NSX port mirroring. /// The cancellation token to use. - /// , , , or is null. - public async Task CreatePortMirroringAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreatePortMirroringAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringData workloadNetworkPortMirroring, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1408,7 +1566,7 @@ public async Task CreatePortMirroringAsync(string resourceGroupName, s throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); } - using var message = CreateCreatePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + using var message = CreateCreatePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1421,14 +1579,19 @@ public async Task CreatePortMirroringAsync(string resourceGroupName, s } /// Create a port mirroring profile by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. /// NSX port mirroring. /// The cancellation token to use. - /// , , , or is null. - public Response CreatePortMirroring(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreatePortMirroring(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringData workloadNetworkPortMirroring, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1446,7 +1609,7 @@ public Response CreatePortMirroring(string resourceGroupName, string privateClou throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); } - using var message = CreateCreatePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + using var message = CreateCreatePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1458,7 +1621,7 @@ public Response CreatePortMirroring(string resourceGroupName, string privateClou } } - internal HttpMessage CreateUpdatePortMirroringRequest(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring) + internal HttpMessage CreateUpdatePortMirroringRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringData workloadNetworkPortMirroring) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1485,14 +1648,19 @@ internal HttpMessage CreateUpdatePortMirroringRequest(string resourceGroupName, } /// Create or update a port mirroring profile by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. /// NSX port mirroring. /// The cancellation token to use. - /// , , , or is null. - public async Task UpdatePortMirroringAsync(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task UpdatePortMirroringAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringData workloadNetworkPortMirroring, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1510,7 +1678,7 @@ public async Task UpdatePortMirroringAsync(string resourceGroupName, s throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); } - using var message = CreateUpdatePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + using var message = CreateUpdatePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1523,14 +1691,19 @@ public async Task UpdatePortMirroringAsync(string resourceGroupName, s } /// Create or update a port mirroring profile by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. /// NSX port mirroring. /// The cancellation token to use. - /// , , , or is null. - public Response UpdatePortMirroring(string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroring workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response UpdatePortMirroring(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, WorkloadNetworkPortMirroringData workloadNetworkPortMirroring, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1548,7 +1721,7 @@ public Response UpdatePortMirroring(string resourceGroupName, string privateClou throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); } - using var message = CreateUpdatePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); + using var message = CreateUpdatePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId, workloadNetworkPortMirroring); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1560,7 +1733,7 @@ public Response UpdatePortMirroring(string resourceGroupName, string privateClou } } - internal HttpMessage CreateDeletePortMirroringRequest(string resourceGroupName, string privateCloudName, string portMirroringId) + internal HttpMessage CreateDeletePortMirroringRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1583,13 +1756,18 @@ internal HttpMessage CreateDeletePortMirroringRequest(string resourceGroupName, } /// Delete a port mirroring profile by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. /// The cancellation token to use. - /// , , or is null. - public async Task DeletePortMirroringAsync(string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeletePortMirroringAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1603,7 +1781,7 @@ public async Task DeletePortMirroringAsync(string resourceGroupName, s throw new ArgumentNullException(nameof(portMirroringId)); } - using var message = CreateDeletePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId); + using var message = CreateDeletePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1617,13 +1795,18 @@ public async Task DeletePortMirroringAsync(string resourceGroupName, s } /// Delete a port mirroring profile by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. /// The cancellation token to use. - /// , , or is null. - public Response DeletePortMirroring(string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response DeletePortMirroring(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1637,7 +1820,7 @@ public Response DeletePortMirroring(string resourceGroupName, string privateClou throw new ArgumentNullException(nameof(portMirroringId)); } - using var message = CreateDeletePortMirroringRequest(resourceGroupName, privateCloudName, portMirroringId); + using var message = CreateDeletePortMirroringRequest(subscriptionId, resourceGroupName, privateCloudName, portMirroringId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1650,7 +1833,7 @@ public Response DeletePortMirroring(string resourceGroupName, string privateClou } } - internal HttpMessage CreateGetVMGroupsRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListVMGroupsRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1672,12 +1855,17 @@ internal HttpMessage CreateGetVMGroupsRequest(string resourceGroupName, string p } /// List of vm groups in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetVMGroupsAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListVMGroupsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1687,7 +1875,7 @@ public async Task> GetVMGroupsAsync(string throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetVMGroupsRequest(resourceGroupName, privateCloudName); + using var message = CreateListVMGroupsRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1704,12 +1892,17 @@ public async Task> GetVMGroupsAsync(string } /// List of vm groups in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetVMGroups(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListVMGroups(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1719,7 +1912,7 @@ public Response GetVMGroups(string resourceGroupNam throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetVMGroupsRequest(resourceGroupName, privateCloudName); + using var message = CreateListVMGroupsRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1735,7 +1928,7 @@ public Response GetVMGroups(string resourceGroupNam } } - internal HttpMessage CreateGetVMGroupRequest(string resourceGroupName, string privateCloudName, string vmGroupId) + internal HttpMessage CreateGetVMGroupRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1758,13 +1951,18 @@ internal HttpMessage CreateGetVMGroupRequest(string resourceGroupName, string pr } /// Get a vm group by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX VM Group identifier. Generally the same as the VM Group's display name. /// The cancellation token to use. - /// , , or is null. - public async Task> GetVMGroupAsync(string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetVMGroupAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1778,30 +1976,37 @@ public async Task> GetVMGroupAsync(string resou throw new ArgumentNullException(nameof(vmGroupId)); } - using var message = CreateGetVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId); + using var message = CreateGetVMGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkVMGroup value = default; + WorkloadNetworkVMGroupData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + value = WorkloadNetworkVMGroupData.DeserializeWorkloadNetworkVMGroupData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkVMGroupData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get a vm group by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX VM Group identifier. Generally the same as the VM Group's display name. /// The cancellation token to use. - /// , , or is null. - public Response GetVMGroup(string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response GetVMGroup(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1815,23 +2020,25 @@ public Response GetVMGroup(string resourceGroupName, str throw new ArgumentNullException(nameof(vmGroupId)); } - using var message = CreateGetVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId); + using var message = CreateGetVMGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkVMGroup value = default; + WorkloadNetworkVMGroupData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = WorkloadNetworkVMGroup.DeserializeWorkloadNetworkVMGroup(document.RootElement); + value = WorkloadNetworkVMGroupData.DeserializeWorkloadNetworkVMGroupData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkVMGroupData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreateVMGroupRequest(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup) + internal HttpMessage CreateCreateVMGroupRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroupData workloadNetworkVMGroup) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1858,14 +2065,19 @@ internal HttpMessage CreateCreateVMGroupRequest(string resourceGroupName, string } /// Create a vm group by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX VM Group identifier. Generally the same as the VM Group's display name. /// NSX VM Group. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateVMGroupAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateVMGroupAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroupData workloadNetworkVMGroup, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1883,7 +2095,7 @@ public async Task CreateVMGroupAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); } - using var message = CreateCreateVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); + using var message = CreateCreateVMGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1896,14 +2108,19 @@ public async Task CreateVMGroupAsync(string resourceGroupName, string } /// Create a vm group by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX VM Group identifier. Generally the same as the VM Group's display name. /// NSX VM Group. /// The cancellation token to use. - /// , , , or is null. - public Response CreateVMGroup(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateVMGroup(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroupData workloadNetworkVMGroup, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1921,7 +2138,7 @@ public Response CreateVMGroup(string resourceGroupName, string privateCloudName, throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); } - using var message = CreateCreateVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); + using var message = CreateCreateVMGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -1933,7 +2150,7 @@ public Response CreateVMGroup(string resourceGroupName, string privateCloudName, } } - internal HttpMessage CreateUpdateVMGroupRequest(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup) + internal HttpMessage CreateUpdateVMGroupRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroupData workloadNetworkVMGroup) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1960,14 +2177,19 @@ internal HttpMessage CreateUpdateVMGroupRequest(string resourceGroupName, string } /// Create or update a vm group by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX VM Group identifier. Generally the same as the VM Group's display name. /// NSX VM Group. /// The cancellation token to use. - /// , , , or is null. - public async Task UpdateVMGroupAsync(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task UpdateVMGroupAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroupData workloadNetworkVMGroup, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -1985,7 +2207,7 @@ public async Task UpdateVMGroupAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); } - using var message = CreateUpdateVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); + using var message = CreateUpdateVMGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -1998,14 +2220,19 @@ public async Task UpdateVMGroupAsync(string resourceGroupName, string } /// Create or update a vm group by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX VM Group identifier. Generally the same as the VM Group's display name. /// NSX VM Group. /// The cancellation token to use. - /// , , , or is null. - public Response UpdateVMGroup(string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroup workloadNetworkVMGroup, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response UpdateVMGroup(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, WorkloadNetworkVMGroupData workloadNetworkVMGroup, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2023,7 +2250,7 @@ public Response UpdateVMGroup(string resourceGroupName, string privateCloudName, throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); } - using var message = CreateUpdateVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); + using var message = CreateUpdateVMGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId, workloadNetworkVMGroup); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -2035,7 +2262,7 @@ public Response UpdateVMGroup(string resourceGroupName, string privateCloudName, } } - internal HttpMessage CreateDeleteVMGroupRequest(string resourceGroupName, string privateCloudName, string vmGroupId) + internal HttpMessage CreateDeleteVMGroupRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2058,13 +2285,18 @@ internal HttpMessage CreateDeleteVMGroupRequest(string resourceGroupName, string } /// Delete a vm group by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX VM Group identifier. Generally the same as the VM Group's display name. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteVMGroupAsync(string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteVMGroupAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2078,7 +2310,7 @@ public async Task DeleteVMGroupAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(vmGroupId)); } - using var message = CreateDeleteVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId); + using var message = CreateDeleteVMGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -2092,13 +2324,18 @@ public async Task DeleteVMGroupAsync(string resourceGroupName, string } /// Delete a vm group by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX VM Group identifier. Generally the same as the VM Group's display name. /// The cancellation token to use. - /// , , or is null. - public Response DeleteVMGroup(string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response DeleteVMGroup(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2112,7 +2349,7 @@ public Response DeleteVMGroup(string resourceGroupName, string privateCloudName, throw new ArgumentNullException(nameof(vmGroupId)); } - using var message = CreateDeleteVMGroupRequest(resourceGroupName, privateCloudName, vmGroupId); + using var message = CreateDeleteVMGroupRequest(subscriptionId, resourceGroupName, privateCloudName, vmGroupId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -2125,7 +2362,7 @@ public Response DeleteVMGroup(string resourceGroupName, string privateCloudName, } } - internal HttpMessage CreateGetVirtualMachinesRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListVirtualMachinesRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2147,12 +2384,17 @@ internal HttpMessage CreateGetVirtualMachinesRequest(string resourceGroupName, s } /// List of virtual machines in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetVirtualMachinesAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListVirtualMachinesAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2162,7 +2404,7 @@ public async Task> GetVirtualMachin throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetVirtualMachinesRequest(resourceGroupName, privateCloudName); + using var message = CreateListVirtualMachinesRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -2179,12 +2421,17 @@ public async Task> GetVirtualMachin } /// List of virtual machines in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetVirtualMachines(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListVirtualMachines(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2194,7 +2441,7 @@ public Response GetVirtualMachines(string re throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetVirtualMachinesRequest(resourceGroupName, privateCloudName); + using var message = CreateListVirtualMachinesRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -2210,7 +2457,7 @@ public Response GetVirtualMachines(string re } } - internal HttpMessage CreateGetVirtualMachineRequest(string resourceGroupName, string privateCloudName, string virtualMachineId) + internal HttpMessage CreateGetVirtualMachineRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2233,13 +2480,18 @@ internal HttpMessage CreateGetVirtualMachineRequest(string resourceGroupName, st } /// Get a virtual machine by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Virtual Machine identifier. /// The cancellation token to use. - /// , , or is null. - public async Task> GetVirtualMachineAsync(string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetVirtualMachineAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2253,30 +2505,37 @@ public async Task> GetVirtualMachineAsyn throw new ArgumentNullException(nameof(virtualMachineId)); } - using var message = CreateGetVirtualMachineRequest(resourceGroupName, privateCloudName, virtualMachineId); + using var message = CreateGetVirtualMachineRequest(subscriptionId, resourceGroupName, privateCloudName, virtualMachineId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkVirtualMachine value = default; + WorkloadNetworkVirtualMachineData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkVirtualMachine.DeserializeWorkloadNetworkVirtualMachine(document.RootElement); + value = WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkVirtualMachineData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get a virtual machine by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// Virtual Machine identifier. /// The cancellation token to use. - /// , , or is null. - public Response GetVirtualMachine(string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response GetVirtualMachine(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2290,23 +2549,25 @@ public Response GetVirtualMachine(string resource throw new ArgumentNullException(nameof(virtualMachineId)); } - using var message = CreateGetVirtualMachineRequest(resourceGroupName, privateCloudName, virtualMachineId); + using var message = CreateGetVirtualMachineRequest(subscriptionId, resourceGroupName, privateCloudName, virtualMachineId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkVirtualMachine value = default; + WorkloadNetworkVirtualMachineData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = WorkloadNetworkVirtualMachine.DeserializeWorkloadNetworkVirtualMachine(document.RootElement); + value = WorkloadNetworkVirtualMachineData.DeserializeWorkloadNetworkVirtualMachineData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkVirtualMachineData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateGetDnsServicesRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListDnsServicesRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2328,12 +2589,17 @@ internal HttpMessage CreateGetDnsServicesRequest(string resourceGroupName, strin } /// List of DNS services in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetDnsServicesAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListDnsServicesAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2343,7 +2609,7 @@ public async Task> GetDnsServicesAsync( throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDnsServicesRequest(resourceGroupName, privateCloudName); + using var message = CreateListDnsServicesRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -2360,12 +2626,17 @@ public async Task> GetDnsServicesAsync( } /// List of DNS services in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetDnsServices(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListDnsServices(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2375,7 +2646,7 @@ public Response GetDnsServices(string resourceGr throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDnsServicesRequest(resourceGroupName, privateCloudName); + using var message = CreateListDnsServicesRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -2391,7 +2662,7 @@ public Response GetDnsServices(string resourceGr } } - internal HttpMessage CreateGetDnsServiceRequest(string resourceGroupName, string privateCloudName, string dnsServiceId) + internal HttpMessage CreateGetDnsServiceRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2414,13 +2685,18 @@ internal HttpMessage CreateGetDnsServiceRequest(string resourceGroupName, string } /// Get a DNS service by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. /// The cancellation token to use. - /// , , or is null. - public async Task> GetDnsServiceAsync(string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetDnsServiceAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2434,30 +2710,37 @@ public async Task> GetDnsServiceAsync(string throw new ArgumentNullException(nameof(dnsServiceId)); } - using var message = CreateGetDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId); + using var message = CreateGetDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkDnsService value = default; + WorkloadNetworkDnsServiceData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + value = WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkDnsServiceData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get a DNS service by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. /// The cancellation token to use. - /// , , or is null. - public Response GetDnsService(string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response GetDnsService(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2471,23 +2754,25 @@ public Response GetDnsService(string resourceGroupNam throw new ArgumentNullException(nameof(dnsServiceId)); } - using var message = CreateGetDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId); + using var message = CreateGetDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkDnsService value = default; + WorkloadNetworkDnsServiceData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = WorkloadNetworkDnsService.DeserializeWorkloadNetworkDnsService(document.RootElement); + value = WorkloadNetworkDnsServiceData.DeserializeWorkloadNetworkDnsServiceData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkDnsServiceData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreateDnsServiceRequest(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService) + internal HttpMessage CreateCreateDnsServiceRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData workloadNetworkDnsService) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2514,14 +2799,19 @@ internal HttpMessage CreateCreateDnsServiceRequest(string resourceGroupName, str } /// Create a DNS service by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. /// NSX DNS Service. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateDnsServiceAsync(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateDnsServiceAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData workloadNetworkDnsService, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2539,7 +2829,7 @@ public async Task CreateDnsServiceAsync(string resourceGroupName, stri throw new ArgumentNullException(nameof(workloadNetworkDnsService)); } - using var message = CreateCreateDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + using var message = CreateCreateDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -2552,14 +2842,19 @@ public async Task CreateDnsServiceAsync(string resourceGroupName, stri } /// Create a DNS service by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. /// NSX DNS Service. /// The cancellation token to use. - /// , , , or is null. - public Response CreateDnsService(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateDnsService(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData workloadNetworkDnsService, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2577,7 +2872,7 @@ public Response CreateDnsService(string resourceGroupName, string privateCloudNa throw new ArgumentNullException(nameof(workloadNetworkDnsService)); } - using var message = CreateCreateDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + using var message = CreateCreateDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -2589,7 +2884,7 @@ public Response CreateDnsService(string resourceGroupName, string privateCloudNa } } - internal HttpMessage CreateUpdateDnsServiceRequest(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService) + internal HttpMessage CreateUpdateDnsServiceRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData workloadNetworkDnsService) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2616,14 +2911,19 @@ internal HttpMessage CreateUpdateDnsServiceRequest(string resourceGroupName, str } /// Create or update a DNS service by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. /// NSX DNS Service. /// The cancellation token to use. - /// , , , or is null. - public async Task UpdateDnsServiceAsync(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task UpdateDnsServiceAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData workloadNetworkDnsService, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2641,7 +2941,7 @@ public async Task UpdateDnsServiceAsync(string resourceGroupName, stri throw new ArgumentNullException(nameof(workloadNetworkDnsService)); } - using var message = CreateUpdateDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + using var message = CreateUpdateDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -2654,14 +2954,19 @@ public async Task UpdateDnsServiceAsync(string resourceGroupName, stri } /// Create or update a DNS service by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. /// NSX DNS Service. /// The cancellation token to use. - /// , , , or is null. - public Response UpdateDnsService(string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsService workloadNetworkDnsService, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response UpdateDnsService(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, WorkloadNetworkDnsServiceData workloadNetworkDnsService, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2679,7 +2984,7 @@ public Response UpdateDnsService(string resourceGroupName, string privateCloudNa throw new ArgumentNullException(nameof(workloadNetworkDnsService)); } - using var message = CreateUpdateDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); + using var message = CreateUpdateDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId, workloadNetworkDnsService); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -2691,7 +2996,7 @@ public Response UpdateDnsService(string resourceGroupName, string privateCloudNa } } - internal HttpMessage CreateDeleteDnsServiceRequest(string resourceGroupName, string privateCloudName, string dnsServiceId) + internal HttpMessage CreateDeleteDnsServiceRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2714,13 +3019,18 @@ internal HttpMessage CreateDeleteDnsServiceRequest(string resourceGroupName, str } /// Delete a DNS service by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteDnsServiceAsync(string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteDnsServiceAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2734,7 +3044,7 @@ public async Task DeleteDnsServiceAsync(string resourceGroupName, stri throw new ArgumentNullException(nameof(dnsServiceId)); } - using var message = CreateDeleteDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId); + using var message = CreateDeleteDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -2748,13 +3058,18 @@ public async Task DeleteDnsServiceAsync(string resourceGroupName, stri } /// Delete a DNS service by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. /// The cancellation token to use. - /// , , or is null. - public Response DeleteDnsService(string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response DeleteDnsService(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2768,7 +3083,7 @@ public Response DeleteDnsService(string resourceGroupName, string privateCloudNa throw new ArgumentNullException(nameof(dnsServiceId)); } - using var message = CreateDeleteDnsServiceRequest(resourceGroupName, privateCloudName, dnsServiceId); + using var message = CreateDeleteDnsServiceRequest(subscriptionId, resourceGroupName, privateCloudName, dnsServiceId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -2781,7 +3096,7 @@ public Response DeleteDnsService(string resourceGroupName, string privateCloudNa } } - internal HttpMessage CreateGetDnsZonesRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListDnsZonesRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2803,12 +3118,17 @@ internal HttpMessage CreateGetDnsZonesRequest(string resourceGroupName, string p } /// List of DNS zones in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetDnsZonesAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListDnsZonesAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2818,7 +3138,7 @@ public async Task> GetDnsZonesAsync(string throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDnsZonesRequest(resourceGroupName, privateCloudName); + using var message = CreateListDnsZonesRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -2835,12 +3155,17 @@ public async Task> GetDnsZonesAsync(string } /// List of DNS zones in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetDnsZones(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListDnsZones(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2850,7 +3175,7 @@ public Response GetDnsZones(string resourceGroupNam throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDnsZonesRequest(resourceGroupName, privateCloudName); + using var message = CreateListDnsZonesRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -2866,7 +3191,7 @@ public Response GetDnsZones(string resourceGroupNam } } - internal HttpMessage CreateGetDnsZoneRequest(string resourceGroupName, string privateCloudName, string dnsZoneId) + internal HttpMessage CreateGetDnsZoneRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2889,13 +3214,18 @@ internal HttpMessage CreateGetDnsZoneRequest(string resourceGroupName, string pr } /// Get a DNS zone by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. /// The cancellation token to use. - /// , , or is null. - public async Task> GetDnsZoneAsync(string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetDnsZoneAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2909,30 +3239,37 @@ public async Task> GetDnsZoneAsync(string resou throw new ArgumentNullException(nameof(dnsZoneId)); } - using var message = CreateGetDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId); + using var message = CreateGetDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkDnsZone value = default; + WorkloadNetworkDnsZoneData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + value = WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkDnsZoneData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get a DNS zone by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. /// The cancellation token to use. - /// , , or is null. - public Response GetDnsZone(string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response GetDnsZone(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -2946,23 +3283,25 @@ public Response GetDnsZone(string resourceGroupName, str throw new ArgumentNullException(nameof(dnsZoneId)); } - using var message = CreateGetDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId); + using var message = CreateGetDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkDnsZone value = default; + WorkloadNetworkDnsZoneData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = WorkloadNetworkDnsZone.DeserializeWorkloadNetworkDnsZone(document.RootElement); + value = WorkloadNetworkDnsZoneData.DeserializeWorkloadNetworkDnsZoneData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkDnsZoneData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreateDnsZoneRequest(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone) + internal HttpMessage CreateCreateDnsZoneRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData workloadNetworkDnsZone) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -2989,14 +3328,19 @@ internal HttpMessage CreateCreateDnsZoneRequest(string resourceGroupName, string } /// Create a DNS zone by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. /// NSX DNS Zone. /// The cancellation token to use. - /// , , , or is null. - public async Task CreateDnsZoneAsync(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreateDnsZoneAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData workloadNetworkDnsZone, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3014,7 +3358,7 @@ public async Task CreateDnsZoneAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); } - using var message = CreateCreateDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + using var message = CreateCreateDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -3027,14 +3371,19 @@ public async Task CreateDnsZoneAsync(string resourceGroupName, string } /// Create a DNS zone by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. /// NSX DNS Zone. /// The cancellation token to use. - /// , , , or is null. - public Response CreateDnsZone(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreateDnsZone(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData workloadNetworkDnsZone, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3052,7 +3401,7 @@ public Response CreateDnsZone(string resourceGroupName, string privateCloudName, throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); } - using var message = CreateCreateDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + using var message = CreateCreateDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -3064,7 +3413,7 @@ public Response CreateDnsZone(string resourceGroupName, string privateCloudName, } } - internal HttpMessage CreateUpdateDnsZoneRequest(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone) + internal HttpMessage CreateUpdateDnsZoneRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData workloadNetworkDnsZone) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3091,14 +3440,19 @@ internal HttpMessage CreateUpdateDnsZoneRequest(string resourceGroupName, string } /// Create or update a DNS zone by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. /// NSX DNS Zone. /// The cancellation token to use. - /// , , , or is null. - public async Task UpdateDnsZoneAsync(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task UpdateDnsZoneAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData workloadNetworkDnsZone, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3116,7 +3470,7 @@ public async Task UpdateDnsZoneAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); } - using var message = CreateUpdateDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + using var message = CreateUpdateDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -3129,14 +3483,19 @@ public async Task UpdateDnsZoneAsync(string resourceGroupName, string } /// Create or update a DNS zone by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. /// NSX DNS Zone. /// The cancellation token to use. - /// , , , or is null. - public Response UpdateDnsZone(string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZone workloadNetworkDnsZone, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response UpdateDnsZone(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, WorkloadNetworkDnsZoneData workloadNetworkDnsZone, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3154,7 +3513,7 @@ public Response UpdateDnsZone(string resourceGroupName, string privateCloudName, throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); } - using var message = CreateUpdateDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); + using var message = CreateUpdateDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId, workloadNetworkDnsZone); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -3166,7 +3525,7 @@ public Response UpdateDnsZone(string resourceGroupName, string privateCloudName, } } - internal HttpMessage CreateDeleteDnsZoneRequest(string resourceGroupName, string privateCloudName, string dnsZoneId) + internal HttpMessage CreateDeleteDnsZoneRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3189,13 +3548,18 @@ internal HttpMessage CreateDeleteDnsZoneRequest(string resourceGroupName, string } /// Delete a DNS zone by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. /// The cancellation token to use. - /// , , or is null. - public async Task DeleteDnsZoneAsync(string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeleteDnsZoneAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3209,7 +3573,7 @@ public async Task DeleteDnsZoneAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(dnsZoneId)); } - using var message = CreateDeleteDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId); + using var message = CreateDeleteDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -3223,13 +3587,18 @@ public async Task DeleteDnsZoneAsync(string resourceGroupName, string } /// Delete a DNS zone by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. /// The cancellation token to use. - /// , , or is null. - public Response DeleteDnsZone(string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response DeleteDnsZone(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3243,7 +3612,7 @@ public Response DeleteDnsZone(string resourceGroupName, string privateCloudName, throw new ArgumentNullException(nameof(dnsZoneId)); } - using var message = CreateDeleteDnsZoneRequest(resourceGroupName, privateCloudName, dnsZoneId); + using var message = CreateDeleteDnsZoneRequest(subscriptionId, resourceGroupName, privateCloudName, dnsZoneId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -3256,7 +3625,7 @@ public Response DeleteDnsZone(string resourceGroupName, string privateCloudName, } } - internal HttpMessage CreateGetPublicIPsRequest(string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListPublicIPsRequest(string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3278,12 +3647,17 @@ internal HttpMessage CreateGetPublicIPsRequest(string resourceGroupName, string } /// List of Public IP Blocks in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public async Task> GetPublicIPsAsync(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public async Task> ListPublicIPsAsync(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3293,7 +3667,7 @@ public async Task> GetPublicIPsAsync(stri throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetPublicIPsRequest(resourceGroupName, privateCloudName); + using var message = CreateListPublicIPsRequest(subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -3310,12 +3684,17 @@ public async Task> GetPublicIPsAsync(stri } /// List of Public IP Blocks in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// or is null. - public Response GetPublicIPs(string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , or is null. + public Response ListPublicIPs(string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3325,7 +3704,7 @@ public Response GetPublicIPs(string resourceGroupN throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetPublicIPsRequest(resourceGroupName, privateCloudName); + using var message = CreateListPublicIPsRequest(subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -3341,7 +3720,7 @@ public Response GetPublicIPs(string resourceGroupN } } - internal HttpMessage CreateGetPublicIPRequest(string resourceGroupName, string privateCloudName, string publicIPId) + internal HttpMessage CreateGetPublicIPRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3364,13 +3743,18 @@ internal HttpMessage CreateGetPublicIPRequest(string resourceGroupName, string p } /// Get a Public IP Block by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. /// The cancellation token to use. - /// , , or is null. - public async Task> GetPublicIPAsync(string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> GetPublicIPAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3384,30 +3768,37 @@ public async Task> GetPublicIPAsync(string res throw new ArgumentNullException(nameof(publicIPId)); } - using var message = CreateGetPublicIPRequest(resourceGroupName, privateCloudName, publicIPId); + using var message = CreateGetPublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - WorkloadNetworkPublicIP value = default; + WorkloadNetworkPublicIPData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); + value = WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkPublicIPData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } } /// Get a Public IP Block by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. /// The cancellation token to use. - /// , , or is null. - public Response GetPublicIP(string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response GetPublicIP(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3421,23 +3812,25 @@ public Response GetPublicIP(string resourceGroupName, s throw new ArgumentNullException(nameof(publicIPId)); } - using var message = CreateGetPublicIPRequest(resourceGroupName, privateCloudName, publicIPId); + using var message = CreateGetPublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - WorkloadNetworkPublicIP value = default; + WorkloadNetworkPublicIPData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = WorkloadNetworkPublicIP.DeserializeWorkloadNetworkPublicIP(document.RootElement); + value = WorkloadNetworkPublicIPData.DeserializeWorkloadNetworkPublicIPData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((WorkloadNetworkPublicIPData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } } - internal HttpMessage CreateCreatePublicIPRequest(string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP) + internal HttpMessage CreateCreatePublicIPRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIPData workloadNetworkPublicIP) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3464,14 +3857,19 @@ internal HttpMessage CreateCreatePublicIPRequest(string resourceGroupName, strin } /// Create a Public IP Block by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. /// NSX Public IP Block. /// The cancellation token to use. - /// , , , or is null. - public async Task CreatePublicIPAsync(string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP, CancellationToken cancellationToken = default) + /// , , , , or is null. + public async Task CreatePublicIPAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIPData workloadNetworkPublicIP, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3489,7 +3887,7 @@ public async Task CreatePublicIPAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(workloadNetworkPublicIP)); } - using var message = CreateCreatePublicIPRequest(resourceGroupName, privateCloudName, publicIPId, workloadNetworkPublicIP); + using var message = CreateCreatePublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId, workloadNetworkPublicIP); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -3502,14 +3900,19 @@ public async Task CreatePublicIPAsync(string resourceGroupName, string } /// Create a Public IP Block by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. /// NSX Public IP Block. /// The cancellation token to use. - /// , , , or is null. - public Response CreatePublicIP(string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIP workloadNetworkPublicIP, CancellationToken cancellationToken = default) + /// , , , , or is null. + public Response CreatePublicIP(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, WorkloadNetworkPublicIPData workloadNetworkPublicIP, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3527,7 +3930,7 @@ public Response CreatePublicIP(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(workloadNetworkPublicIP)); } - using var message = CreateCreatePublicIPRequest(resourceGroupName, privateCloudName, publicIPId, workloadNetworkPublicIP); + using var message = CreateCreatePublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId, workloadNetworkPublicIP); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -3539,7 +3942,7 @@ public Response CreatePublicIP(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateDeletePublicIPRequest(string resourceGroupName, string privateCloudName, string publicIPId) + internal HttpMessage CreateDeletePublicIPRequest(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3562,13 +3965,18 @@ internal HttpMessage CreateDeletePublicIPRequest(string resourceGroupName, strin } /// Delete a Public IP Block by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. /// The cancellation token to use. - /// , , or is null. - public async Task DeletePublicIPAsync(string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task DeletePublicIPAsync(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3582,7 +3990,7 @@ public async Task DeletePublicIPAsync(string resourceGroupName, string throw new ArgumentNullException(nameof(publicIPId)); } - using var message = CreateDeletePublicIPRequest(resourceGroupName, privateCloudName, publicIPId); + using var message = CreateDeletePublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -3596,13 +4004,18 @@ public async Task DeletePublicIPAsync(string resourceGroupName, string } /// Delete a Public IP Block by id in a private cloud workload network. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. /// The cancellation token to use. - /// , , or is null. - public Response DeletePublicIP(string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response DeletePublicIP(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId, CancellationToken cancellationToken = default) { + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3616,7 +4029,7 @@ public Response DeletePublicIP(string resourceGroupName, string privateCloudName throw new ArgumentNullException(nameof(publicIPId)); } - using var message = CreateDeletePublicIPRequest(resourceGroupName, privateCloudName, publicIPId); + using var message = CreateDeletePublicIPRequest(subscriptionId, resourceGroupName, privateCloudName, publicIPId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -3629,7 +4042,7 @@ public Response DeletePublicIP(string resourceGroupName, string privateCloudName } } - internal HttpMessage CreateGetSegmentsNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListSegmentsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3645,16 +4058,21 @@ internal HttpMessage CreateGetSegmentsNextPageRequest(string nextLink, string re /// List of segments in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetSegmentsNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListSegmentsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3664,7 +4082,7 @@ public async Task> GetSegmentsNextPageAsyn throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetSegmentsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListSegmentsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -3682,16 +4100,21 @@ public async Task> GetSegmentsNextPageAsyn /// List of segments in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetSegmentsNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListSegmentsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3701,7 +4124,7 @@ public Response GetSegmentsNextPage(string nextLink throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetSegmentsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListSegmentsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -3717,7 +4140,7 @@ public Response GetSegmentsNextPage(string nextLink } } - internal HttpMessage CreateGetDhcpNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListDhcpNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3733,16 +4156,21 @@ internal HttpMessage CreateGetDhcpNextPageRequest(string nextLink, string resour /// List dhcp in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetDhcpNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListDhcpNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3752,7 +4180,7 @@ public async Task> GetDhcpNextPageAsync(string throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDhcpNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListDhcpNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -3770,16 +4198,21 @@ public async Task> GetDhcpNextPageAsync(string /// List dhcp in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetDhcpNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListDhcpNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3789,7 +4222,7 @@ public Response GetDhcpNextPage(string nextLink, string throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDhcpNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListDhcpNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -3805,7 +4238,7 @@ public Response GetDhcpNextPage(string nextLink, string } } - internal HttpMessage CreateGetGatewaysNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListGatewaysNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3821,16 +4254,21 @@ internal HttpMessage CreateGetGatewaysNextPageRequest(string nextLink, string re /// List of gateways in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetGatewaysNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListGatewaysNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3840,7 +4278,7 @@ public async Task> GetGatewaysNextPageAsync throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetGatewaysNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListGatewaysNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -3858,16 +4296,21 @@ public async Task> GetGatewaysNextPageAsync /// List of gateways in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetGatewaysNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListGatewaysNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3877,7 +4320,7 @@ public Response GetGatewaysNextPage(string nextLink, throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetGatewaysNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListGatewaysNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -3893,7 +4336,7 @@ public Response GetGatewaysNextPage(string nextLink, } } - internal HttpMessage CreateGetPortMirroringNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListPortMirroringNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3909,16 +4352,21 @@ internal HttpMessage CreateGetPortMirroringNextPageRequest(string nextLink, stri /// List of port mirroring profiles in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetPortMirroringNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListPortMirroringNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3928,7 +4376,7 @@ public async Task> GetPortMirroringNe throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetPortMirroringNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListPortMirroringNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -3946,16 +4394,21 @@ public async Task> GetPortMirroringNe /// List of port mirroring profiles in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetPortMirroringNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListPortMirroringNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -3965,7 +4418,7 @@ public Response GetPortMirroringNextPage(strin throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetPortMirroringNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListPortMirroringNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -3981,7 +4434,7 @@ public Response GetPortMirroringNextPage(strin } } - internal HttpMessage CreateGetVMGroupsNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListVMGroupsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -3997,16 +4450,21 @@ internal HttpMessage CreateGetVMGroupsNextPageRequest(string nextLink, string re /// List of vm groups in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetVMGroupsNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListVMGroupsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -4016,7 +4474,7 @@ public async Task> GetVMGroupsNextPageAsyn throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetVMGroupsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListVMGroupsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -4034,16 +4492,21 @@ public async Task> GetVMGroupsNextPageAsyn /// List of vm groups in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetVMGroupsNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListVMGroupsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -4053,7 +4516,7 @@ public Response GetVMGroupsNextPage(string nextLink throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetVMGroupsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListVMGroupsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -4069,7 +4532,7 @@ public Response GetVMGroupsNextPage(string nextLink } } - internal HttpMessage CreateGetVirtualMachinesNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListVirtualMachinesNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -4085,16 +4548,21 @@ internal HttpMessage CreateGetVirtualMachinesNextPageRequest(string nextLink, st /// List of virtual machines in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetVirtualMachinesNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListVirtualMachinesNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -4104,7 +4572,7 @@ public async Task> GetVirtualMachin throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetVirtualMachinesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListVirtualMachinesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -4122,16 +4590,21 @@ public async Task> GetVirtualMachin /// List of virtual machines in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetVirtualMachinesNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListVirtualMachinesNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -4141,7 +4614,7 @@ public Response GetVirtualMachinesNextPage(s throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetVirtualMachinesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListVirtualMachinesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -4157,7 +4630,7 @@ public Response GetVirtualMachinesNextPage(s } } - internal HttpMessage CreateGetDnsServicesNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListDnsServicesNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -4173,16 +4646,21 @@ internal HttpMessage CreateGetDnsServicesNextPageRequest(string nextLink, string /// List of DNS services in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetDnsServicesNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListDnsServicesNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -4192,7 +4670,7 @@ public async Task> GetDnsServicesNextPa throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDnsServicesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListDnsServicesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -4210,16 +4688,21 @@ public async Task> GetDnsServicesNextPa /// List of DNS services in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetDnsServicesNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListDnsServicesNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -4229,7 +4712,7 @@ public Response GetDnsServicesNextPage(string ne throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDnsServicesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListDnsServicesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -4245,7 +4728,7 @@ public Response GetDnsServicesNextPage(string ne } } - internal HttpMessage CreateGetDnsZonesNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListDnsZonesNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -4261,16 +4744,21 @@ internal HttpMessage CreateGetDnsZonesNextPageRequest(string nextLink, string re /// List of DNS zones in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetDnsZonesNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListDnsZonesNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -4280,7 +4768,7 @@ public async Task> GetDnsZonesNextPageAsyn throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDnsZonesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListDnsZonesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -4298,16 +4786,21 @@ public async Task> GetDnsZonesNextPageAsyn /// List of DNS zones in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetDnsZonesNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListDnsZonesNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -4317,7 +4810,7 @@ public Response GetDnsZonesNextPage(string nextLink throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetDnsZonesNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListDnsZonesNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -4333,7 +4826,7 @@ public Response GetDnsZonesNextPage(string nextLink } } - internal HttpMessage CreateGetPublicIPsNextPageRequest(string nextLink, string resourceGroupName, string privateCloudName) + internal HttpMessage CreateListPublicIPsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -4349,16 +4842,21 @@ internal HttpMessage CreateGetPublicIPsNextPageRequest(string nextLink, string r /// List of Public IP Blocks in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public async Task> GetPublicIPsNextPageAsync(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public async Task> ListPublicIPsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -4368,7 +4866,7 @@ public async Task> GetPublicIPsNextPageAs throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetPublicIPsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListPublicIPsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -4386,16 +4884,21 @@ public async Task> GetPublicIPsNextPageAs /// List of Public IP Blocks in a private cloud workload network. /// The URL to the next page of results. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// Name of the private cloud. /// The cancellation token to use. - /// , , or is null. - public Response GetPublicIPsNextPage(string nextLink, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) + /// , , , or is null. + public Response ListPublicIPsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string privateCloudName, CancellationToken cancellationToken = default) { if (nextLink == null) { throw new ArgumentNullException(nameof(nextLink)); } + if (subscriptionId == null) + { + throw new ArgumentNullException(nameof(subscriptionId)); + } if (resourceGroupName == null) { throw new ArgumentNullException(nameof(resourceGroupName)); @@ -4405,7 +4908,7 @@ public Response GetPublicIPsNextPage(string nextLi throw new ArgumentNullException(nameof(privateCloudName)); } - using var message = CreateGetPublicIPsNextPageRequest(nextLink, resourceGroupName, privateCloudName); + using var message = CreateListPublicIPsNextPageRequest(nextLink, subscriptionId, resourceGroupName, privateCloudName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdlet.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdlet.cs new file mode 100644 index 000000000000..83a7d433327a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdlet.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a ScriptCmdlet along with the instance operations that can be performed on it. + public partial class ScriptCmdlet : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName, string scriptCmdletName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ScriptCmdletsRestOperations _scriptCmdletsRestClient; + private readonly ScriptCmdletData _data; + + /// Initializes a new instance of the class for mocking. + protected ScriptCmdlet() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ScriptCmdlet(ArmResource options, ScriptCmdletData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptCmdletsRestClient = new ScriptCmdletsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ScriptCmdlet(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptCmdletsRestClient = new ScriptCmdletsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal ScriptCmdlet(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptCmdletsRestClient = new ScriptCmdletsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/scriptPackages/scriptCmdlets"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ScriptCmdletData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Return information about a script cmdlet resource in a specific package on a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptCmdlet.Get"); + scope.Start(); + try + { + var response = await _scriptCmdletsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ScriptCmdlet(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Return information about a script cmdlet resource in a specific package on a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptCmdlet.Get"); + scope.Start(); + try + { + var response = _scriptCmdletsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ScriptCmdlet(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptCmdlet.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptCmdlet.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs new file mode 100644 index 000000000000..a0fce21c4abf --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletCollection.cs @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of ScriptCmdlet and their operations over its parent. + public partial class ScriptCmdletCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ScriptCmdletsRestOperations _scriptCmdletsRestClient; + + /// Initializes a new instance of the class for mocking. + protected ScriptCmdletCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal ScriptCmdletCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptCmdletsRestClient = new ScriptCmdletsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ScriptPackage.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ScriptPackage.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Return information about a script cmdlet resource in a specific package on a private cloud. + /// Name of the script cmdlet resource in the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string scriptCmdletName, CancellationToken cancellationToken = default) + { + if (scriptCmdletName == null) + { + throw new ArgumentNullException(nameof(scriptCmdletName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptCmdletCollection.Get"); + scope.Start(); + try + { + var response = _scriptCmdletsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptCmdletName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ScriptCmdlet(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Return information about a script cmdlet resource in a specific package on a private cloud. + /// Name of the script cmdlet resource in the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string scriptCmdletName, CancellationToken cancellationToken = default) + { + if (scriptCmdletName == null) + { + throw new ArgumentNullException(nameof(scriptCmdletName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptCmdletCollection.Get"); + scope.Start(); + try + { + var response = await _scriptCmdletsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptCmdletName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ScriptCmdlet(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the script cmdlet resource in the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string scriptCmdletName, CancellationToken cancellationToken = default) + { + if (scriptCmdletName == null) + { + throw new ArgumentNullException(nameof(scriptCmdletName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptCmdletCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scriptCmdletsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptCmdletName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new ScriptCmdlet(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the script cmdlet resource in the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string scriptCmdletName, CancellationToken cancellationToken = default) + { + if (scriptCmdletName == null) + { + throw new ArgumentNullException(nameof(scriptCmdletName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptCmdletCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scriptCmdletsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptCmdletName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new ScriptCmdlet(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the script cmdlet resource in the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string scriptCmdletName, CancellationToken cancellationToken = default) + { + if (scriptCmdletName == null) + { + throw new ArgumentNullException(nameof(scriptCmdletName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptCmdletCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(scriptCmdletName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the script cmdlet resource in the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string scriptCmdletName, CancellationToken cancellationToken = default) + { + if (scriptCmdletName == null) + { + throw new ArgumentNullException(nameof(scriptCmdletName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptCmdletCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(scriptCmdletName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptCmdletCollection.GetAll"); + scope.Start(); + try + { + var response = _scriptCmdletsRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScriptCmdlet(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptCmdletCollection.GetAll"); + scope.Start(); + try + { + var response = _scriptCmdletsRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScriptCmdlet(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List script cmdlet resources available for a private cloud to create a script execution resource on a private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptCmdletCollection.GetAll"); + scope.Start(); + try + { + var response = await _scriptCmdletsRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScriptCmdlet(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptCmdletCollection.GetAll"); + scope.Start(); + try + { + var response = await _scriptCmdletsRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScriptCmdlet(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs similarity index 74% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs index 8ef53a48e236..538c560225aa 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptCmdlet.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptCmdletData.cs @@ -7,28 +7,28 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// A cmdlet available for script execution. - public partial class ScriptCmdlet : Resource + /// A class representing the ScriptCmdlet data model. + public partial class ScriptCmdletData : Resource { - /// Initializes a new instance of ScriptCmdlet. - public ScriptCmdlet() + /// Initializes a new instance of ScriptCmdletData. + public ScriptCmdletData() { Parameters = new ChangeTrackingList(); } - /// Initializes a new instance of ScriptCmdlet. + /// Initializes a new instance of ScriptCmdletData. /// The id. /// The name. /// The type. /// Description of the scripts functionality. /// Recommended time limit for execution. /// Parameters the script will accept. - internal ScriptCmdlet(ResourceIdentifier id, string name, ResourceType type, string description, string timeout, IReadOnlyList parameters) : base(id, name, type) + internal ScriptCmdletData(ResourceIdentifier id, string name, ResourceType type, string description, string timeout, IReadOnlyList parameters) : base(id, name, type) { Description = description; Timeout = timeout; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs new file mode 100644 index 000000000000..b706e349c98d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecution.cs @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a ScriptExecution along with the instance operations that can be performed on it. + public partial class ScriptExecution : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptExecutionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ScriptExecutionsRestOperations _scriptExecutionsRestClient; + private readonly ScriptExecutionData _data; + + /// Initializes a new instance of the class for mocking. + protected ScriptExecution() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ScriptExecution(ArmResource options, ScriptExecutionData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptExecutionsRestClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ScriptExecution(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptExecutionsRestClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal ScriptExecution(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptExecutionsRestClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/scriptExecutions"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ScriptExecutionData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get an script execution by name in a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Get"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get an script execution by name in a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Get"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Cancel a ScriptExecution in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Delete"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ScriptExecutionDeleteOperation(_clientDiagnostics, Pipeline, _scriptExecutionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Cancel a ScriptExecution in a private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual ScriptExecutionDeleteOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.Delete"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new ScriptExecutionDeleteOperation(_clientDiagnostics, Pipeline, _scriptExecutionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Return the logs for a script execution resource. + /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. + /// The cancellation token to use. + public async virtual Task> GetExecutionLogsAsync(IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.GetExecutionLogs"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.GetExecutionLogsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptOutputStreamType, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Return the logs for a script execution resource. + /// Name of the desired output stream to return. If not provided, will return all. An empty array will return nothing. + /// The cancellation token to use. + public virtual Response GetExecutionLogs(IEnumerable scriptOutputStreamType = null, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecution.GetExecutionLogs"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.GetExecutionLogs(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, scriptOutputStreamType, cancellationToken); + return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs new file mode 100644 index 000000000000..17ab0f87cefc --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionCollection.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of ScriptExecution and their operations over its parent. + public partial class ScriptExecutionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ScriptExecutionsRestOperations _scriptExecutionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected ScriptExecutionCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal ScriptExecutionCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptExecutionsRestClient = new ScriptExecutionsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Create or update a script execution in a private cloud. + /// Name of the user-invoked script execution resource. + /// A script running in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual ScriptExecutionCreateOrUpdateOperation CreateOrUpdate(bool waitForCompletion, string scriptExecutionName, ScriptExecutionData scriptExecution, CancellationToken cancellationToken = default) + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + if (scriptExecution == null) + { + throw new ArgumentNullException(nameof(scriptExecution)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution, cancellationToken); + var operation = new ScriptExecutionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _scriptExecutionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a script execution in a private cloud. + /// Name of the user-invoked script execution resource. + /// A script running in the private cloud. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string scriptExecutionName, ScriptExecutionData scriptExecution, CancellationToken cancellationToken = default) + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + if (scriptExecution == null) + { + throw new ArgumentNullException(nameof(scriptExecution)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution, cancellationToken).ConfigureAwait(false); + var operation = new ScriptExecutionCreateOrUpdateOperation(Parent, _clientDiagnostics, Pipeline, _scriptExecutionsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptExecutionName, scriptExecution).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get an script execution by name in a private cloud. + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string scriptExecutionName, CancellationToken cancellationToken = default) + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.Get"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ScriptExecution(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get an script execution by name in a private cloud. + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string scriptExecutionName, CancellationToken cancellationToken = default) + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.Get"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ScriptExecution(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string scriptExecutionName, CancellationToken cancellationToken = default) + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string scriptExecutionName, CancellationToken cancellationToken = default) + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptExecutionName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new ScriptExecution(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string scriptExecutionName, CancellationToken cancellationToken = default) + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(scriptExecutionName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the user-invoked script execution resource. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string scriptExecutionName, CancellationToken cancellationToken = default) + { + if (scriptExecutionName == null) + { + throw new ArgumentNullException(nameof(scriptExecutionName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(scriptExecutionName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List script executions in a private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); + scope.Start(); + try + { + var response = _scriptExecutionsRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List script executions in a private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptExecutionCollection.GetAll"); + scope.Start(); + try + { + var response = await _scriptExecutionsRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScriptExecution(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs similarity index 85% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs index 717b41236a2d..b1f875071735 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptExecution.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptExecutionData.cs @@ -8,16 +8,16 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// An instance of a script executed by a user - custom or AVS. - public partial class ScriptExecution : Resource + /// A class representing the ScriptExecution data model. + public partial class ScriptExecutionData : Resource { - /// Initializes a new instance of ScriptExecution. - public ScriptExecution() + /// Initializes a new instance of ScriptExecutionData. + public ScriptExecutionData() { Parameters = new ChangeTrackingList(); HiddenParameters = new ChangeTrackingList(); @@ -28,7 +28,7 @@ public ScriptExecution() Errors = new ChangeTrackingList(); } - /// Initializes a new instance of ScriptExecution. + /// Initializes a new instance of ScriptExecutionData. /// The id. /// The name. /// The type. @@ -47,7 +47,7 @@ public ScriptExecution() /// Standard information out stream from the powershell execution. /// Standard warning out stream from the powershell execution. /// Standard error output stream from the powershell execution. - internal ScriptExecution(ResourceIdentifier id, string name, ResourceType type, string scriptCmdletId, IList parameters, IList hiddenParameters, string failureReason, string timeout, string retention, DateTimeOffset? submittedAt, DateTimeOffset? startedAt, DateTimeOffset? finishedAt, ScriptExecutionProvisioningState? provisioningState, IList output, IDictionary namedOutputs, IReadOnlyList information, IReadOnlyList warnings, IReadOnlyList errors) : base(id, name, type) + internal ScriptExecutionData(ResourceIdentifier id, string name, ResourceType type, string scriptCmdletId, IList parameters, IList hiddenParameters, string failureReason, string timeout, string retention, DateTimeOffset? submittedAt, DateTimeOffset? startedAt, DateTimeOffset? finishedAt, ScriptExecutionProvisioningState? provisioningState, IList output, IDictionary namedOutputs, IReadOnlyList information, IReadOnlyList warnings, IReadOnlyList errors) : base(id, name, type) { ScriptCmdletId = scriptCmdletId; Parameters = parameters; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackage.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackage.cs new file mode 100644 index 000000000000..c1e438b4cdf0 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackage.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a ScriptPackage along with the instance operations that can be performed on it. + public partial class ScriptPackage : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string scriptPackageName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ScriptPackagesRestOperations _scriptPackagesRestClient; + private readonly ScriptPackageData _data; + + /// Initializes a new instance of the class for mocking. + protected ScriptPackage() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ScriptPackage(ArmResource options, ScriptPackageData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ScriptPackage(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal ScriptPackage(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/scriptPackages"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ScriptPackageData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get a script package available to run on a private cloud. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptPackage.Get"); + scope.Start(); + try + { + var response = await _scriptPackagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ScriptPackage(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a script package available to run on a private cloud. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptPackage.Get"); + scope.Start(); + try + { + var response = _scriptPackagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ScriptPackage(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptPackage.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("ScriptPackage.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + #region ScriptCmdlet + + /// Gets a collection of ScriptCmdlets in the ScriptPackage. + /// An object representing collection of ScriptCmdlets and their operations over a ScriptPackage. + public virtual ScriptCmdletCollection GetScriptCmdlets() + { + return new ScriptCmdletCollection(this); + } + #endregion + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs new file mode 100644 index 000000000000..7b67d043e0e5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageCollection.cs @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of ScriptPackage and their operations over its parent. + public partial class ScriptPackageCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly ScriptPackagesRestOperations _scriptPackagesRestClient; + + /// Initializes a new instance of the class for mocking. + protected ScriptPackageCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal ScriptPackageCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _scriptPackagesRestClient = new ScriptPackagesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Get a script package available to run on a private cloud. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string scriptPackageName, CancellationToken cancellationToken = default) + { + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptPackageCollection.Get"); + scope.Start(); + try + { + var response = _scriptPackagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptPackageName, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ScriptPackage(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a script package available to run on a private cloud. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string scriptPackageName, CancellationToken cancellationToken = default) + { + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptPackageCollection.Get"); + scope.Start(); + try + { + var response = await _scriptPackagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptPackageName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new ScriptPackage(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string scriptPackageName, CancellationToken cancellationToken = default) + { + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptPackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = _scriptPackagesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptPackageName, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new ScriptPackage(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string scriptPackageName, CancellationToken cancellationToken = default) + { + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptPackageCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _scriptPackagesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, scriptPackageName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new ScriptPackage(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string scriptPackageName, CancellationToken cancellationToken = default) + { + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptPackageCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(scriptPackageName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Name of the script package in the private cloud. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string scriptPackageName, CancellationToken cancellationToken = default) + { + if (scriptPackageName == null) + { + throw new ArgumentNullException(nameof(scriptPackageName)); + } + + using var scope = _clientDiagnostics.CreateScope("ScriptPackageCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(scriptPackageName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List script packages available to run on the private cloud. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptPackageCollection.GetAll"); + scope.Start(); + try + { + var response = _scriptPackagesRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScriptPackage(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptPackageCollection.GetAll"); + scope.Start(); + try + { + var response = _scriptPackagesRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScriptPackage(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List script packages available to run on the private cloud. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptPackageCollection.GetAll"); + scope.Start(); + try + { + var response = await _scriptPackagesRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScriptPackage(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("ScriptPackageCollection.GetAll"); + scope.Start(); + try + { + var response = await _scriptPackagesRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScriptPackage(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs similarity index 69% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs index 95af1787e821..2f96545736a9 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/ScriptPackage.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageData.cs @@ -5,26 +5,26 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// Script Package resources available for execution. - public partial class ScriptPackage : Resource + /// A class representing the ScriptPackage data model. + public partial class ScriptPackageData : Resource { - /// Initializes a new instance of ScriptPackage. - public ScriptPackage() + /// Initializes a new instance of ScriptPackageData. + public ScriptPackageData() { } - /// Initializes a new instance of ScriptPackage. + /// Initializes a new instance of ScriptPackageData. /// The id. /// The name. /// The type. /// User friendly description of the package. /// Module version. - internal ScriptPackage(ResourceIdentifier id, string name, ResourceType type, string description, string version) : base(id, name, type) + internal ScriptPackageData(ResourceIdentifier id, string name, ResourceType type, string description, string version) : base(id, name, type) { Description = description; Version = version; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachine.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachine.cs new file mode 100644 index 000000000000..69c4d93e5db7 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachine.cs @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a VirtualMachine along with the instance operations that can be performed on it. + public partial class VirtualMachine : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string clusterName, string virtualMachineId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly VirtualMachinesRestOperations _virtualMachinesRestClient; + private readonly VirtualMachineData _data; + + /// Initializes a new instance of the class for mocking. + protected VirtualMachine() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal VirtualMachine(ArmResource options, VirtualMachineData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _virtualMachinesRestClient = new VirtualMachinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal VirtualMachine(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _virtualMachinesRestClient = new VirtualMachinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal VirtualMachine(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _virtualMachinesRestClient = new VirtualMachinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/clusters/virtualMachines"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual VirtualMachineData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get a virtual machine by id in a private cloud cluster. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("VirtualMachine.Get"); + scope.Start(); + try + { + var response = await _virtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new VirtualMachine(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a virtual machine by id in a private cloud cluster. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("VirtualMachine.Get"); + scope.Start(); + try + { + var response = _virtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new VirtualMachine(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("VirtualMachine.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("VirtualMachine.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Enable or disable DRS-driven VM movement restriction. + /// Whether VM DRS-driven movement is restricted (Enabled) or not (Disabled). + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task RestrictMovementAsync(bool waitForCompletion, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) + { + if (restrictMovement == null) + { + throw new ArgumentNullException(nameof(restrictMovement)); + } + + using var scope = _clientDiagnostics.CreateScope("VirtualMachine.RestrictMovement"); + scope.Start(); + try + { + var response = await _virtualMachinesRestClient.RestrictMovementAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement, cancellationToken).ConfigureAwait(false); + var operation = new VirtualMachineRestrictMovementOperation(_clientDiagnostics, Pipeline, _virtualMachinesRestClient.CreateRestrictMovementRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Enable or disable DRS-driven VM movement restriction. + /// Whether VM DRS-driven movement is restricted (Enabled) or not (Disabled). + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual VirtualMachineRestrictMovementOperation RestrictMovement(bool waitForCompletion, VirtualMachineRestrictMovement restrictMovement, CancellationToken cancellationToken = default) + { + if (restrictMovement == null) + { + throw new ArgumentNullException(nameof(restrictMovement)); + } + + using var scope = _clientDiagnostics.CreateScope("VirtualMachine.RestrictMovement"); + scope.Start(); + try + { + var response = _virtualMachinesRestClient.RestrictMovement(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement, cancellationToken); + var operation = new VirtualMachineRestrictMovementOperation(_clientDiagnostics, Pipeline, _virtualMachinesRestClient.CreateRestrictMovementRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, restrictMovement).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineCollection.cs new file mode 100644 index 000000000000..0447fae252dd --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineCollection.cs @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of VirtualMachine and their operations over its parent. + public partial class VirtualMachineCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly VirtualMachinesRestOperations _virtualMachinesRestClient; + + /// Initializes a new instance of the class for mocking. + protected VirtualMachineCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal VirtualMachineCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _virtualMachinesRestClient = new VirtualMachinesRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != Cluster.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, Cluster.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Get a virtual machine by id in a private cloud cluster. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("VirtualMachineCollection.Get"); + scope.Start(); + try + { + var response = _virtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new VirtualMachine(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a virtual machine by id in a private cloud cluster. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("VirtualMachineCollection.Get"); + scope.Start(); + try + { + var response = await _virtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new VirtualMachine(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("VirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _virtualMachinesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new VirtualMachine(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("VirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _virtualMachinesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new VirtualMachine(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("VirtualMachineCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(virtualMachineId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("VirtualMachineCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of virtual machines in a private cloud cluster. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("VirtualMachineCollection.GetAll"); + scope.Start(); + try + { + var response = _virtualMachinesRestClient.List(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new VirtualMachine(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("VirtualMachineCollection.GetAll"); + scope.Start(); + try + { + var response = _virtualMachinesRestClient.ListNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new VirtualMachine(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of virtual machines in a private cloud cluster. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("VirtualMachineCollection.GetAll"); + scope.Start(); + try + { + var response = await _virtualMachinesRestClient.ListAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new VirtualMachine(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("VirtualMachineCollection.GetAll"); + scope.Start(); + try + { + var response = await _virtualMachinesRestClient.ListNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new VirtualMachine(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineData.cs similarity index 75% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineData.cs index 719876088237..20d5c8286628 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/VirtualMachine.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/VirtualMachineData.cs @@ -5,20 +5,21 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// Virtual Machine. - public partial class VirtualMachine : Resource + /// A class representing the VirtualMachine data model. + public partial class VirtualMachineData : Resource { - /// Initializes a new instance of VirtualMachine. - public VirtualMachine() + /// Initializes a new instance of VirtualMachineData. + public VirtualMachineData() { } - /// Initializes a new instance of VirtualMachine. + /// Initializes a new instance of VirtualMachineData. /// The id. /// The name. /// The type. @@ -26,7 +27,7 @@ public VirtualMachine() /// Virtual machine managed object reference id. /// Path to virtual machine's folder starting from datacenter virtual machine folder. /// Whether VM DRS-driven movement is restricted (enabled) or not (disabled). - internal VirtualMachine(ResourceIdentifier id, string name, ResourceType type, string displayName, string moRefId, string folderPath, VirtualMachineRestrictMovementState? restrictMovement) : base(id, name, type) + internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType type, string displayName, string moRefId, string folderPath, VirtualMachineRestrictMovementState? restrictMovement) : base(id, name, type) { DisplayName = displayName; MoRefId = moRefId; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcp.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcp.cs new file mode 100644 index 000000000000..8c5a49c633e4 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcp.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a WorkloadNetworkDhcp along with the instance operations that can be performed on it. + public partial class WorkloadNetworkDhcp : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string dhcpId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + private readonly WorkloadNetworkDhcpData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkDhcp() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadNetworkDhcp(ArmResource options, WorkloadNetworkDhcpData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkDhcp(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkDhcp(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/dhcpConfigurations"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadNetworkDhcpData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get dhcp by id in a private cloud workload network. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcp.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkDhcp(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get dhcp by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcp.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDhcp(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcp.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcp.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete dhcp by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcp.Delete"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.DeleteDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeleteDhcpOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeleteDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete dhcp by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeleteDhcpOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcp.Delete"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.DeleteDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeleteDhcpOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeleteDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update dhcp by id in a private cloud workload network. + /// NSX DHCP. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateAsync(bool waitForCompletion, WorkloadNetworkDhcpData workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcp.Update"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.UpdateDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDhcp, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdateDhcpOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdateDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDhcp).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update dhcp by id in a private cloud workload network. + /// NSX DHCP. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdateDhcpOperation Update(bool waitForCompletion, WorkloadNetworkDhcpData workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcp.Update"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.UpdateDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDhcp, cancellationToken); + var operation = new WorkloadNetworkUpdateDhcpOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdateDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDhcp).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs new file mode 100644 index 000000000000..9f3ad3bd32d1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpCollection.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of WorkloadNetworkDhcp and their operations over its parent. + public partial class WorkloadNetworkDhcpCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkDhcpCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal WorkloadNetworkDhcpCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Create dhcp by id in a private cloud workload network. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// NSX DHCP. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WorkloadNetworkCreateDhcpOperation CreateOrUpdate(bool waitForCompletion, string dhcpId, WorkloadNetworkDhcpData workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.CreateDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp, cancellationToken); + var operation = new WorkloadNetworkCreateDhcpOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreateDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create dhcp by id in a private cloud workload network. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// NSX DHCP. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string dhcpId, WorkloadNetworkDhcpData workloadNetworkDhcp, CancellationToken cancellationToken = default) + { + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + if (workloadNetworkDhcp == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDhcp)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.CreateDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreateDhcpOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreateDhcpRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dhcpId, workloadNetworkDhcp).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get dhcp by id in a private cloud workload network. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string dhcpId, CancellationToken cancellationToken = default) + { + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dhcpId, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDhcp(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get dhcp by id in a private cloud workload network. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string dhcpId, CancellationToken cancellationToken = default) + { + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dhcpId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkDhcp(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string dhcpId, CancellationToken cancellationToken = default) + { + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dhcpId, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDhcp(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string dhcpId, CancellationToken cancellationToken = default) + { + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dhcpId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDhcp(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string dhcpId, CancellationToken cancellationToken = default) + { + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(dhcpId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DHCP identifier. Generally the same as the DHCP display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string dhcpId, CancellationToken cancellationToken = default) + { + if (dhcpId == null) + { + throw new ArgumentNullException(nameof(dhcpId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(dhcpId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List dhcp in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListDhcp(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDhcp(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListDhcpNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDhcp(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List dhcp in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListDhcpAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDhcp(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDhcpCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListDhcpNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDhcp(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.cs similarity index 59% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.cs index 01e94630aecb..38b31735f729 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDhcp.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDhcpData.cs @@ -5,25 +5,26 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// NSX DHCP. - public partial class WorkloadNetworkDhcp : Resource + /// A class representing the WorkloadNetworkDhcp data model. + public partial class WorkloadNetworkDhcpData : Resource { - /// Initializes a new instance of WorkloadNetworkDhcp. - public WorkloadNetworkDhcp() + /// Initializes a new instance of WorkloadNetworkDhcpData. + public WorkloadNetworkDhcpData() { } - /// Initializes a new instance of WorkloadNetworkDhcp. + /// Initializes a new instance of WorkloadNetworkDhcpData. /// The id. /// The name. /// The type. /// DHCP properties. - internal WorkloadNetworkDhcp(ResourceIdentifier id, string name, ResourceType type, WorkloadNetworkDhcpEntity properties) : base(id, name, type) + internal WorkloadNetworkDhcpData(ResourceIdentifier id, string name, ResourceType type, WorkloadNetworkDhcpEntity properties) : base(id, name, type) { Properties = properties; } diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsService.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsService.cs new file mode 100644 index 000000000000..b4998d9bc389 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsService.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a WorkloadNetworkDnsService along with the instance operations that can be performed on it. + public partial class WorkloadNetworkDnsService : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsServiceId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + private readonly WorkloadNetworkDnsServiceData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkDnsService() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadNetworkDnsService(ArmResource options, WorkloadNetworkDnsServiceData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkDnsService(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkDnsService(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/dnsServices"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadNetworkDnsServiceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get a DNS service by id in a private cloud workload network. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsService.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkDnsService(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS service by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsService.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsService(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsService.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsService.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a DNS service by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsService.Delete"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.DeleteDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeleteDnsServiceOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeleteDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a DNS service by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeleteDnsServiceOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsService.Delete"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.DeleteDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeleteDnsServiceOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeleteDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a DNS service by id in a private cloud workload network. + /// NSX DNS Service. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateAsync(bool waitForCompletion, WorkloadNetworkDnsServiceData workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsService.Update"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.UpdateDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDnsService, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdateDnsServiceOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdateDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDnsService).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a DNS service by id in a private cloud workload network. + /// NSX DNS Service. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdateDnsServiceOperation Update(bool waitForCompletion, WorkloadNetworkDnsServiceData workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsService.Update"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.UpdateDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDnsService, cancellationToken); + var operation = new WorkloadNetworkUpdateDnsServiceOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdateDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDnsService).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs new file mode 100644 index 000000000000..957acef9d178 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceCollection.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of WorkloadNetworkDnsService and their operations over its parent. + public partial class WorkloadNetworkDnsServiceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkDnsServiceCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal WorkloadNetworkDnsServiceCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Create a DNS service by id in a private cloud workload network. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// NSX DNS Service. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WorkloadNetworkCreateDnsServiceOperation CreateOrUpdate(bool waitForCompletion, string dnsServiceId, WorkloadNetworkDnsServiceData workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.CreateDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsServiceId, workloadNetworkDnsService, cancellationToken); + var operation = new WorkloadNetworkCreateDnsServiceOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreateDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsServiceId, workloadNetworkDnsService).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a DNS service by id in a private cloud workload network. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// NSX DNS Service. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string dnsServiceId, WorkloadNetworkDnsServiceData workloadNetworkDnsService, CancellationToken cancellationToken = default) + { + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + if (workloadNetworkDnsService == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsService)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.CreateDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsServiceId, workloadNetworkDnsService, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreateDnsServiceOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreateDnsServiceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsServiceId, workloadNetworkDnsService).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS service by id in a private cloud workload network. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string dnsServiceId, CancellationToken cancellationToken = default) + { + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsServiceId, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsService(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS service by id in a private cloud workload network. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string dnsServiceId, CancellationToken cancellationToken = default) + { + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsServiceId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkDnsService(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string dnsServiceId, CancellationToken cancellationToken = default) + { + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsService(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsServiceId, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsService(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string dnsServiceId, CancellationToken cancellationToken = default) + { + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsServiceAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsServiceId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsService(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string dnsServiceId, CancellationToken cancellationToken = default) + { + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(dnsServiceId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DNS Service identifier. Generally the same as the DNS Service's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string dnsServiceId, CancellationToken cancellationToken = default) + { + if (dnsServiceId == null) + { + throw new ArgumentNullException(nameof(dnsServiceId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(dnsServiceId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of DNS services in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListDnsServices(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDnsService(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListDnsServicesNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDnsService(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of DNS services in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListDnsServicesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDnsService(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsServiceCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListDnsServicesNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDnsService(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.cs similarity index 77% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.cs index 93d65b096bd9..45c9ce608e73 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsService.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsServiceData.cs @@ -7,21 +7,21 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// NSX DNS Service. - public partial class WorkloadNetworkDnsService : Resource + /// A class representing the WorkloadNetworkDnsService data model. + public partial class WorkloadNetworkDnsServiceData : Resource { - /// Initializes a new instance of WorkloadNetworkDnsService. - public WorkloadNetworkDnsService() + /// Initializes a new instance of WorkloadNetworkDnsServiceData. + public WorkloadNetworkDnsServiceData() { FqdnZones = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkDnsService. + /// Initializes a new instance of WorkloadNetworkDnsServiceData. /// The id. /// The name. /// The type. @@ -33,7 +33,7 @@ public WorkloadNetworkDnsService() /// DNS Service status. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkDnsService(ResourceIdentifier id, string name, ResourceType type, string displayName, string dnsServiceIp, string defaultDnsZone, IList fqdnZones, DnsServiceLogLevelEnum? logLevel, DnsServiceStatusEnum? status, WorkloadNetworkDnsServiceProvisioningState? provisioningState, long? revision) : base(id, name, type) + internal WorkloadNetworkDnsServiceData(ResourceIdentifier id, string name, ResourceType type, string displayName, string dnsServiceIp, string defaultDnsZone, IList fqdnZones, DnsServiceLogLevelEnum? logLevel, DnsServiceStatusEnum? status, WorkloadNetworkDnsServiceProvisioningState? provisioningState, long? revision) : base(id, name, type) { DisplayName = displayName; DnsServiceIp = dnsServiceIp; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZone.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZone.cs new file mode 100644 index 000000000000..3e0a502a809a --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZone.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a WorkloadNetworkDnsZone along with the instance operations that can be performed on it. + public partial class WorkloadNetworkDnsZone : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string dnsZoneId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + private readonly WorkloadNetworkDnsZoneData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkDnsZone() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadNetworkDnsZone(ArmResource options, WorkloadNetworkDnsZoneData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkDnsZone(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkDnsZone(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/dnsZones"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadNetworkDnsZoneData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get a DNS zone by id in a private cloud workload network. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZone.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkDnsZone(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS zone by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZone.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsZone(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZone.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZone.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a DNS zone by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZone.Delete"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.DeleteDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeleteDnsZoneOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeleteDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a DNS zone by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeleteDnsZoneOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZone.Delete"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.DeleteDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeleteDnsZoneOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeleteDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a DNS zone by id in a private cloud workload network. + /// NSX DNS Zone. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateAsync(bool waitForCompletion, WorkloadNetworkDnsZoneData workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZone.Update"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.UpdateDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDnsZone, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdateDnsZoneOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdateDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDnsZone).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a DNS zone by id in a private cloud workload network. + /// NSX DNS Zone. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdateDnsZoneOperation Update(bool waitForCompletion, WorkloadNetworkDnsZoneData workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZone.Update"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.UpdateDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDnsZone, cancellationToken); + var operation = new WorkloadNetworkUpdateDnsZoneOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdateDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkDnsZone).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs new file mode 100644 index 000000000000..d3dbee0d1808 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneCollection.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of WorkloadNetworkDnsZone and their operations over its parent. + public partial class WorkloadNetworkDnsZoneCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkDnsZoneCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal WorkloadNetworkDnsZoneCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Create a DNS zone by id in a private cloud workload network. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// NSX DNS Zone. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WorkloadNetworkCreateDnsZoneOperation CreateOrUpdate(bool waitForCompletion, string dnsZoneId, WorkloadNetworkDnsZoneData workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.CreateDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsZoneId, workloadNetworkDnsZone, cancellationToken); + var operation = new WorkloadNetworkCreateDnsZoneOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreateDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsZoneId, workloadNetworkDnsZone).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a DNS zone by id in a private cloud workload network. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// NSX DNS Zone. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string dnsZoneId, WorkloadNetworkDnsZoneData workloadNetworkDnsZone, CancellationToken cancellationToken = default) + { + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + if (workloadNetworkDnsZone == null) + { + throw new ArgumentNullException(nameof(workloadNetworkDnsZone)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.CreateDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsZoneId, workloadNetworkDnsZone, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreateDnsZoneOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreateDnsZoneRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsZoneId, workloadNetworkDnsZone).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS zone by id in a private cloud workload network. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string dnsZoneId, CancellationToken cancellationToken = default) + { + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsZoneId, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsZone(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a DNS zone by id in a private cloud workload network. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string dnsZoneId, CancellationToken cancellationToken = default) + { + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsZoneId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkDnsZone(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string dnsZoneId, CancellationToken cancellationToken = default) + { + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetDnsZone(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsZoneId, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsZone(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string dnsZoneId, CancellationToken cancellationToken = default) + { + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetDnsZoneAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, dnsZoneId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkDnsZone(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string dnsZoneId, CancellationToken cancellationToken = default) + { + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(dnsZoneId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX DNS Zone identifier. Generally the same as the DNS Zone's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string dnsZoneId, CancellationToken cancellationToken = default) + { + if (dnsZoneId == null) + { + throw new ArgumentNullException(nameof(dnsZoneId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(dnsZoneId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of DNS zones in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListDnsZones(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDnsZone(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListDnsZonesNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDnsZone(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of DNS zones in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListDnsZonesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDnsZone(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkDnsZoneCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListDnsZonesNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkDnsZone(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.cs similarity index 78% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.cs index a7757a9ea2ee..fb6273c2945d 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkDnsZone.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkDnsZoneData.cs @@ -7,22 +7,22 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// NSX DNS Zone. - public partial class WorkloadNetworkDnsZone : Resource + /// A class representing the WorkloadNetworkDnsZone data model. + public partial class WorkloadNetworkDnsZoneData : Resource { - /// Initializes a new instance of WorkloadNetworkDnsZone. - public WorkloadNetworkDnsZone() + /// Initializes a new instance of WorkloadNetworkDnsZoneData. + public WorkloadNetworkDnsZoneData() { Domain = new ChangeTrackingList(); DnsServerIps = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkDnsZone. + /// Initializes a new instance of WorkloadNetworkDnsZoneData. /// The id. /// The name. /// The type. @@ -33,7 +33,7 @@ public WorkloadNetworkDnsZone() /// Number of DNS Services using the DNS zone. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkDnsZone(ResourceIdentifier id, string name, ResourceType type, string displayName, IList domain, IList dnsServerIps, string sourceIp, long? dnsServices, WorkloadNetworkDnsZoneProvisioningState? provisioningState, long? revision) : base(id, name, type) + internal WorkloadNetworkDnsZoneData(ResourceIdentifier id, string name, ResourceType type, string displayName, IList domain, IList dnsServerIps, string sourceIp, long? dnsServices, WorkloadNetworkDnsZoneProvisioningState? provisioningState, long? revision) : base(id, name, type) { DisplayName = displayName; Domain = domain; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGateway.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGateway.cs new file mode 100644 index 000000000000..37e02a511d87 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGateway.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a WorkloadNetworkGateway along with the instance operations that can be performed on it. + public partial class WorkloadNetworkGateway : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string gatewayId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + private readonly WorkloadNetworkGatewayData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkGateway() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadNetworkGateway(ArmResource options, WorkloadNetworkGatewayData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkGateway(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkGateway(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/gateways"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadNetworkGatewayData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get a gateway by id in a private cloud workload network. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGateway.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetGatewayAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkGateway(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a gateway by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGateway.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetGateway(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkGateway(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGateway.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGateway.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs new file mode 100644 index 000000000000..6e1e29e7e535 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayCollection.cs @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of WorkloadNetworkGateway and their operations over its parent. + public partial class WorkloadNetworkGatewayCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkGatewayCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal WorkloadNetworkGatewayCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Get a gateway by id in a private cloud workload network. + /// NSX Gateway identifier. Generally the same as the Gateway's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string gatewayId, CancellationToken cancellationToken = default) + { + if (gatewayId == null) + { + throw new ArgumentNullException(nameof(gatewayId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetGateway(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayId, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkGateway(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a gateway by id in a private cloud workload network. + /// NSX Gateway identifier. Generally the same as the Gateway's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string gatewayId, CancellationToken cancellationToken = default) + { + if (gatewayId == null) + { + throw new ArgumentNullException(nameof(gatewayId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetGatewayAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkGateway(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Gateway identifier. Generally the same as the Gateway's display name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string gatewayId, CancellationToken cancellationToken = default) + { + if (gatewayId == null) + { + throw new ArgumentNullException(nameof(gatewayId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetGateway(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayId, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkGateway(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Gateway identifier. Generally the same as the Gateway's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string gatewayId, CancellationToken cancellationToken = default) + { + if (gatewayId == null) + { + throw new ArgumentNullException(nameof(gatewayId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetGatewayAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, gatewayId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkGateway(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Gateway identifier. Generally the same as the Gateway's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string gatewayId, CancellationToken cancellationToken = default) + { + if (gatewayId == null) + { + throw new ArgumentNullException(nameof(gatewayId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(gatewayId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Gateway identifier. Generally the same as the Gateway's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string gatewayId, CancellationToken cancellationToken = default) + { + if (gatewayId == null) + { + throw new ArgumentNullException(nameof(gatewayId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(gatewayId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of gateways in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListGateways(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkGateway(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListGatewaysNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkGateway(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of gateways in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListGatewaysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkGateway(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkGatewayCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListGatewaysNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkGateway(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs similarity index 66% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs index fd219defe426..e83e90abb692 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkGateway.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkGatewayData.cs @@ -5,26 +5,26 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// NSX Gateway. - public partial class WorkloadNetworkGateway : Resource + /// A class representing the WorkloadNetworkGateway data model. + public partial class WorkloadNetworkGatewayData : Resource { - /// Initializes a new instance of WorkloadNetworkGateway. - public WorkloadNetworkGateway() + /// Initializes a new instance of WorkloadNetworkGatewayData. + public WorkloadNetworkGatewayData() { } - /// Initializes a new instance of WorkloadNetworkGateway. + /// Initializes a new instance of WorkloadNetworkGatewayData. /// The id. /// The name. /// The type. /// Display name of the DHCP entity. /// NSX Gateway Path. - internal WorkloadNetworkGateway(ResourceIdentifier id, string name, ResourceType type, string displayName, string path) : base(id, name, type) + internal WorkloadNetworkGatewayData(ResourceIdentifier id, string name, ResourceType type, string displayName, string path) : base(id, name, type) { DisplayName = displayName; Path = path; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroring.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroring.cs new file mode 100644 index 000000000000..1bf55fc8287d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroring.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a WorkloadNetworkPortMirroring along with the instance operations that can be performed on it. + public partial class WorkloadNetworkPortMirroring : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string portMirroringId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + private readonly WorkloadNetworkPortMirroringData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkPortMirroring() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadNetworkPortMirroring(ArmResource options, WorkloadNetworkPortMirroringData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkPortMirroring(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkPortMirroring(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/portMirroringProfiles"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadNetworkPortMirroringData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get a port mirroring profile by id in a private cloud workload network. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroring.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkPortMirroring(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a port mirroring profile by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroring.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPortMirroring(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroring.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroring.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a port mirroring profile by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroring.Delete"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.DeletePortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeletePortMirroringOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeletePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a port mirroring profile by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeletePortMirroringOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroring.Delete"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.DeletePortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeletePortMirroringOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeletePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a port mirroring profile by id in a private cloud workload network. + /// NSX port mirroring. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateAsync(bool waitForCompletion, WorkloadNetworkPortMirroringData workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroring.Update"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.UpdatePortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkPortMirroring, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdatePortMirroringOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdatePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkPortMirroring).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a port mirroring profile by id in a private cloud workload network. + /// NSX port mirroring. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdatePortMirroringOperation Update(bool waitForCompletion, WorkloadNetworkPortMirroringData workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroring.Update"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.UpdatePortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkPortMirroring, cancellationToken); + var operation = new WorkloadNetworkUpdatePortMirroringOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdatePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkPortMirroring).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringCollection.cs new file mode 100644 index 000000000000..d9d124a14d1d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringCollection.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of WorkloadNetworkPortMirroring and their operations over its parent. + public partial class WorkloadNetworkPortMirroringCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkPortMirroringCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal WorkloadNetworkPortMirroringCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Create a port mirroring profile by id in a private cloud workload network. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// NSX port mirroring. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WorkloadNetworkCreatePortMirroringOperation CreateOrUpdate(bool waitForCompletion, string portMirroringId, WorkloadNetworkPortMirroringData workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.CreatePortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portMirroringId, workloadNetworkPortMirroring, cancellationToken); + var operation = new WorkloadNetworkCreatePortMirroringOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreatePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portMirroringId, workloadNetworkPortMirroring).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a port mirroring profile by id in a private cloud workload network. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// NSX port mirroring. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string portMirroringId, WorkloadNetworkPortMirroringData workloadNetworkPortMirroring, CancellationToken cancellationToken = default) + { + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + if (workloadNetworkPortMirroring == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPortMirroring)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.CreatePortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portMirroringId, workloadNetworkPortMirroring, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreatePortMirroringOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreatePortMirroringRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portMirroringId, workloadNetworkPortMirroring).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a port mirroring profile by id in a private cloud workload network. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string portMirroringId, CancellationToken cancellationToken = default) + { + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portMirroringId, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPortMirroring(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a port mirroring profile by id in a private cloud workload network. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string portMirroringId, CancellationToken cancellationToken = default) + { + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portMirroringId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkPortMirroring(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string portMirroringId, CancellationToken cancellationToken = default) + { + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portMirroringId, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPortMirroring(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string portMirroringId, CancellationToken cancellationToken = default) + { + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, portMirroringId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPortMirroring(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string portMirroringId, CancellationToken cancellationToken = default) + { + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(portMirroringId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Port Mirroring identifier. Generally the same as the Port Mirroring display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string portMirroringId, CancellationToken cancellationToken = default) + { + if (portMirroringId == null) + { + throw new ArgumentNullException(nameof(portMirroringId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(portMirroringId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of port mirroring profiles in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListPortMirroring(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkPortMirroring(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListPortMirroringNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkPortMirroring(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of port mirroring profiles in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListPortMirroringAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkPortMirroring(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPortMirroringCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListPortMirroringNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkPortMirroring(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringData.cs similarity index 74% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringData.cs index d9cba25fc7e2..f12b29b71bce 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPortMirroring.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPortMirroringData.cs @@ -5,20 +5,21 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// NSX Port Mirroring. - public partial class WorkloadNetworkPortMirroring : Resource + /// A class representing the WorkloadNetworkPortMirroring data model. + public partial class WorkloadNetworkPortMirroringData : Resource { - /// Initializes a new instance of WorkloadNetworkPortMirroring. - public WorkloadNetworkPortMirroring() + /// Initializes a new instance of WorkloadNetworkPortMirroringData. + public WorkloadNetworkPortMirroringData() { } - /// Initializes a new instance of WorkloadNetworkPortMirroring. + /// Initializes a new instance of WorkloadNetworkPortMirroringData. /// The id. /// The name. /// The type. @@ -29,7 +30,7 @@ public WorkloadNetworkPortMirroring() /// Port Mirroring Status. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkPortMirroring(ResourceIdentifier id, string name, ResourceType type, string displayName, PortMirroringDirectionEnum? direction, string source, string destination, PortMirroringStatusEnum? status, WorkloadNetworkPortMirroringProvisioningState? provisioningState, long? revision) : base(id, name, type) + internal WorkloadNetworkPortMirroringData(ResourceIdentifier id, string name, ResourceType type, string displayName, PortMirroringDirectionEnum? direction, string source, string destination, PortMirroringStatusEnum? status, WorkloadNetworkPortMirroringProvisioningState? provisioningState, long? revision) : base(id, name, type) { DisplayName = displayName; Direction = direction; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIP.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIP.cs new file mode 100644 index 000000000000..42d23debe9d1 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIP.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a WorkloadNetworkPublicIP along with the instance operations that can be performed on it. + public partial class WorkloadNetworkPublicIP : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string publicIPId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + private readonly WorkloadNetworkPublicIPData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkPublicIP() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadNetworkPublicIP(ArmResource options, WorkloadNetworkPublicIPData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkPublicIP(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkPublicIP(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/publicIPs"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadNetworkPublicIPData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get a Public IP Block by id in a private cloud workload network. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIP.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkPublicIP(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a Public IP Block by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIP.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPublicIP(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIP.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIP.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a Public IP Block by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIP.Delete"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.DeletePublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeletePublicIPOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeletePublicIPRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a Public IP Block by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeletePublicIPOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIP.Delete"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.DeletePublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeletePublicIPOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeletePublicIPRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs new file mode 100644 index 000000000000..413321ad5df5 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPCollection.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of WorkloadNetworkPublicIP and their operations over its parent. + public partial class WorkloadNetworkPublicIPCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkPublicIPCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal WorkloadNetworkPublicIPCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Create a Public IP Block by id in a private cloud workload network. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// NSX Public IP Block. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WorkloadNetworkCreatePublicIPOperation CreateOrUpdate(bool waitForCompletion, string publicIPId, WorkloadNetworkPublicIPData workloadNetworkPublicIP, CancellationToken cancellationToken = default) + { + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + if (workloadNetworkPublicIP == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPublicIP)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.CreatePublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicIPId, workloadNetworkPublicIP, cancellationToken); + var operation = new WorkloadNetworkCreatePublicIPOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreatePublicIPRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicIPId, workloadNetworkPublicIP).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a Public IP Block by id in a private cloud workload network. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// NSX Public IP Block. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string publicIPId, WorkloadNetworkPublicIPData workloadNetworkPublicIP, CancellationToken cancellationToken = default) + { + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + if (workloadNetworkPublicIP == null) + { + throw new ArgumentNullException(nameof(workloadNetworkPublicIP)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.CreatePublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicIPId, workloadNetworkPublicIP, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreatePublicIPOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreatePublicIPRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicIPId, workloadNetworkPublicIP).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a Public IP Block by id in a private cloud workload network. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string publicIPId, CancellationToken cancellationToken = default) + { + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicIPId, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPublicIP(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a Public IP Block by id in a private cloud workload network. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string publicIPId, CancellationToken cancellationToken = default) + { + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicIPId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkPublicIP(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string publicIPId, CancellationToken cancellationToken = default) + { + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetPublicIP(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicIPId, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPublicIP(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string publicIPId, CancellationToken cancellationToken = default) + { + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetPublicIPAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, publicIPId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkPublicIP(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string publicIPId, CancellationToken cancellationToken = default) + { + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(publicIPId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Public IP Block identifier. Generally the same as the Public IP Block's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string publicIPId, CancellationToken cancellationToken = default) + { + if (publicIPId == null) + { + throw new ArgumentNullException(nameof(publicIPId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(publicIPId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of Public IP Blocks in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListPublicIPs(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkPublicIP(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListPublicIPsNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkPublicIP(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of Public IP Blocks in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListPublicIPsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkPublicIP(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkPublicIPCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListPublicIPsNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkPublicIP(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.cs similarity index 71% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.cs index 253df4c4d18f..23fb67d61cdc 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkPublicIP.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkPublicIPData.cs @@ -5,20 +5,21 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// NSX Public IP Block. - public partial class WorkloadNetworkPublicIP : Resource + /// A class representing the WorkloadNetworkPublicIP data model. + public partial class WorkloadNetworkPublicIPData : Resource { - /// Initializes a new instance of WorkloadNetworkPublicIP. - public WorkloadNetworkPublicIP() + /// Initializes a new instance of WorkloadNetworkPublicIPData. + public WorkloadNetworkPublicIPData() { } - /// Initializes a new instance of WorkloadNetworkPublicIP. + /// Initializes a new instance of WorkloadNetworkPublicIPData. /// The id. /// The name. /// The type. @@ -26,7 +27,7 @@ public WorkloadNetworkPublicIP() /// Number of Public IPs requested. /// CIDR Block of the Public IP Block. /// The provisioning state. - internal WorkloadNetworkPublicIP(ResourceIdentifier id, string name, ResourceType type, string displayName, long? numberOfPublicIPs, string publicIPBlock, WorkloadNetworkPublicIPProvisioningState? provisioningState) : base(id, name, type) + internal WorkloadNetworkPublicIPData(ResourceIdentifier id, string name, ResourceType type, string displayName, long? numberOfPublicIPs, string publicIPBlock, WorkloadNetworkPublicIPProvisioningState? provisioningState) : base(id, name, type) { DisplayName = displayName; NumberOfPublicIPs = numberOfPublicIPs; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs new file mode 100644 index 000000000000..a794f0c5fe0d --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegment.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a WorkloadNetworkSegment along with the instance operations that can be performed on it. + public partial class WorkloadNetworkSegment : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string segmentId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + private readonly WorkloadNetworkSegmentData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkSegment() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadNetworkSegment(ArmResource options, WorkloadNetworkSegmentData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkSegment(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkSegment(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/segments"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadNetworkSegmentData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get a segment by id in a private cloud workload network. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a segment by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a segment by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Delete"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.DeleteSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeleteSegmentOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeleteSegmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a segment by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeleteSegmentOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Delete"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.DeleteSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeleteSegmentOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeleteSegmentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a segment by id in a private cloud workload network. + /// NSX Segment. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateAsync(bool waitForCompletion, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + { + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Update"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.UpdateSegmentsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkSegment, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdateSegmentsOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdateSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkSegment).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a segment by id in a private cloud workload network. + /// NSX Segment. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdateSegmentsOperation Update(bool waitForCompletion, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + { + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegment.Update"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.UpdateSegments(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkSegment, cancellationToken); + var operation = new WorkloadNetworkUpdateSegmentsOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdateSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkSegment).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs new file mode 100644 index 000000000000..a892c10d2ec2 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentCollection.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of WorkloadNetworkSegment and their operations over its parent. + public partial class WorkloadNetworkSegmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkSegmentCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal WorkloadNetworkSegmentCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Create a segment by id in a private cloud workload network. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// NSX Segment. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WorkloadNetworkCreateSegmentsOperation CreateOrUpdate(bool waitForCompletion, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.CreateSegments(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, segmentId, workloadNetworkSegment, cancellationToken); + var operation = new WorkloadNetworkCreateSegmentsOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreateSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, segmentId, workloadNetworkSegment).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a segment by id in a private cloud workload network. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// NSX Segment. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string segmentId, WorkloadNetworkSegmentData workloadNetworkSegment, CancellationToken cancellationToken = default) + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + if (workloadNetworkSegment == null) + { + throw new ArgumentNullException(nameof(workloadNetworkSegment)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.CreateSegmentsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, segmentId, workloadNetworkSegment, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreateSegmentsOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreateSegmentsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, segmentId, workloadNetworkSegment).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a segment by id in a private cloud workload network. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string segmentId, CancellationToken cancellationToken = default) + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, segmentId, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkSegment(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a segment by id in a private cloud workload network. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string segmentId, CancellationToken cancellationToken = default) + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, segmentId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkSegment(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string segmentId, CancellationToken cancellationToken = default) + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetSegment(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string segmentId, CancellationToken cancellationToken = default) + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetSegmentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkSegment(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string segmentId, CancellationToken cancellationToken = default) + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(segmentId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX Segment identifier. Generally the same as the Segment's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string segmentId, CancellationToken cancellationToken = default) + { + if (segmentId == null) + { + throw new ArgumentNullException(nameof(segmentId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(segmentId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of segments in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListSegments(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListSegmentsNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of segments in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListSegmentsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkSegmentCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListSegmentsNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkSegment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs similarity index 76% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs index 292ce6fb54c1..fe80a28880c8 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkSegment.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkSegmentData.cs @@ -7,21 +7,21 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// NSX Segment. - public partial class WorkloadNetworkSegment : Resource + /// A class representing the WorkloadNetworkSegment data model. + public partial class WorkloadNetworkSegmentData : Resource { - /// Initializes a new instance of WorkloadNetworkSegment. - public WorkloadNetworkSegment() + /// Initializes a new instance of WorkloadNetworkSegmentData. + public WorkloadNetworkSegmentData() { PortVif = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkSegment. + /// Initializes a new instance of WorkloadNetworkSegmentData. /// The id. /// The name. /// The type. @@ -32,7 +32,7 @@ public WorkloadNetworkSegment() /// Segment status. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkSegment(ResourceIdentifier id, string name, ResourceType type, string displayName, string connectedGateway, WorkloadNetworkSegmentSubnet subnet, IReadOnlyList portVif, SegmentStatusEnum? status, WorkloadNetworkSegmentProvisioningState? provisioningState, long? revision) : base(id, name, type) + internal WorkloadNetworkSegmentData(ResourceIdentifier id, string name, ResourceType type, string displayName, string connectedGateway, WorkloadNetworkSegmentSubnet subnet, IReadOnlyList portVif, SegmentStatusEnum? status, WorkloadNetworkSegmentProvisioningState? provisioningState, long? revision) : base(id, name, type) { DisplayName = displayName; ConnectedGateway = connectedGateway; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroup.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroup.cs new file mode 100644 index 000000000000..67d1d8bee207 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroup.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a WorkloadNetworkVMGroup along with the instance operations that can be performed on it. + public partial class WorkloadNetworkVMGroup : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string vmGroupId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + private readonly WorkloadNetworkVMGroupData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkVMGroup() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadNetworkVMGroup(ArmResource options, WorkloadNetworkVMGroupData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkVMGroup(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkVMGroup(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/vmGroups"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadNetworkVMGroupData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get a vm group by id in a private cloud workload network. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroup.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVMGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkVMGroup(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a vm group by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroup.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVMGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVMGroup(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroup.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroup.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a vm group by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public async virtual Task DeleteAsync(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroup.Delete"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.DeleteVMGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkDeleteVMGroupOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeleteVMGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a vm group by id in a private cloud workload network. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + public virtual WorkloadNetworkDeleteVMGroupOperation Delete(bool waitForCompletion, CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroup.Delete"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.DeleteVMGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + var operation = new WorkloadNetworkDeleteVMGroupOperation(_clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateDeleteVMGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a vm group by id in a private cloud workload network. + /// NSX VM Group. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public async virtual Task UpdateAsync(bool waitForCompletion, WorkloadNetworkVMGroupData workloadNetworkVMGroup, CancellationToken cancellationToken = default) + { + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroup.Update"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.UpdateVMGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkVMGroup, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkUpdateVMGroupOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdateVMGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkVMGroup).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or update a vm group by id in a private cloud workload network. + /// NSX VM Group. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// is null. + public virtual WorkloadNetworkUpdateVMGroupOperation Update(bool waitForCompletion, WorkloadNetworkVMGroupData workloadNetworkVMGroup, CancellationToken cancellationToken = default) + { + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroup.Update"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.UpdateVMGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkVMGroup, cancellationToken); + var operation = new WorkloadNetworkUpdateVMGroupOperation(this, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateUpdateVMGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, workloadNetworkVMGroup).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroupCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroupCollection.cs new file mode 100644 index 000000000000..c4707226a89c --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroupCollection.cs @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Avs.Models; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of WorkloadNetworkVMGroup and their operations over its parent. + public partial class WorkloadNetworkVMGroupCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkVMGroupCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal WorkloadNetworkVMGroupCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Create a vm group by id in a private cloud workload network. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// NSX VM Group. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public virtual WorkloadNetworkCreateVMGroupOperation CreateOrUpdate(bool waitForCompletion, string vmGroupId, WorkloadNetworkVMGroupData workloadNetworkVMGroup, CancellationToken cancellationToken = default) + { + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.CreateVMGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmGroupId, workloadNetworkVMGroup, cancellationToken); + var operation = new WorkloadNetworkCreateVMGroupOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreateVMGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmGroupId, workloadNetworkVMGroup).Request, response); + if (waitForCompletion) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a vm group by id in a private cloud workload network. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// NSX VM Group. + /// Waits for the completion of the long running operations. + /// The cancellation token to use. + /// or is null. + public async virtual Task CreateOrUpdateAsync(bool waitForCompletion, string vmGroupId, WorkloadNetworkVMGroupData workloadNetworkVMGroup, CancellationToken cancellationToken = default) + { + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + if (workloadNetworkVMGroup == null) + { + throw new ArgumentNullException(nameof(workloadNetworkVMGroup)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.CreateVMGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmGroupId, workloadNetworkVMGroup, cancellationToken).ConfigureAwait(false); + var operation = new WorkloadNetworkCreateVMGroupOperation(Parent, _clientDiagnostics, Pipeline, _workloadNetworksRestClient.CreateCreateVMGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmGroupId, workloadNetworkVMGroup).Request, response); + if (waitForCompletion) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a vm group by id in a private cloud workload network. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string vmGroupId, CancellationToken cancellationToken = default) + { + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVMGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmGroupId, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVMGroup(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a vm group by id in a private cloud workload network. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string vmGroupId, CancellationToken cancellationToken = default) + { + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVMGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmGroupId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkVMGroup(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string vmGroupId, CancellationToken cancellationToken = default) + { + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVMGroup(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmGroupId, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVMGroup(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string vmGroupId, CancellationToken cancellationToken = default) + { + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVMGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, vmGroupId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVMGroup(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string vmGroupId, CancellationToken cancellationToken = default) + { + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(vmGroupId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// NSX VM Group identifier. Generally the same as the VM Group's display name. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string vmGroupId, CancellationToken cancellationToken = default) + { + if (vmGroupId == null) + { + throw new ArgumentNullException(nameof(vmGroupId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(vmGroupId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of vm groups in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListVMGroups(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkVMGroup(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListVMGroupsNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkVMGroup(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of vm groups in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListVMGroupsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkVMGroup(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVMGroupCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListVMGroupsNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkVMGroup(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroupData.cs similarity index 74% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroupData.cs index e630d8593563..58a9fbabc7b7 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVMGroup.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVMGroupData.cs @@ -7,21 +7,21 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// NSX VM Group. - public partial class WorkloadNetworkVMGroup : Resource + /// A class representing the WorkloadNetworkVMGroup data model. + public partial class WorkloadNetworkVMGroupData : Resource { - /// Initializes a new instance of WorkloadNetworkVMGroup. - public WorkloadNetworkVMGroup() + /// Initializes a new instance of WorkloadNetworkVMGroupData. + public WorkloadNetworkVMGroupData() { Members = new ChangeTrackingList(); } - /// Initializes a new instance of WorkloadNetworkVMGroup. + /// Initializes a new instance of WorkloadNetworkVMGroupData. /// The id. /// The name. /// The type. @@ -30,7 +30,7 @@ public WorkloadNetworkVMGroup() /// VM Group status. /// The provisioning state. /// NSX revision number. - internal WorkloadNetworkVMGroup(ResourceIdentifier id, string name, ResourceType type, string displayName, IList members, VMGroupStatusEnum? status, WorkloadNetworkVMGroupProvisioningState? provisioningState, long? revision) : base(id, name, type) + internal WorkloadNetworkVMGroupData(ResourceIdentifier id, string name, ResourceType type, string displayName, IList members, VMGroupStatusEnum? status, WorkloadNetworkVMGroupProvisioningState? provisioningState, long? revision) : base(id, name, type) { DisplayName = displayName; Members = members; diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachine.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachine.cs new file mode 100644 index 000000000000..23a831b978ee --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachine.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A Class representing a WorkloadNetworkVirtualMachine along with the instance operations that can be performed on it. + public partial class WorkloadNetworkVirtualMachine : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string privateCloudName, string virtualMachineId) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}"; + return new ResourceIdentifier(resourceId); + } + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + private readonly WorkloadNetworkVirtualMachineData _data; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkVirtualMachine() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadNetworkVirtualMachine(ArmResource options, WorkloadNetworkVirtualMachineData data) : base(options, data.Id) + { + HasData = true; + _data = data; + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkVirtualMachine(ArmResource options, ResourceIdentifier id) : base(options, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Initializes a new instance of the class. + /// The client options to build client context. + /// The credential to build client context. + /// The uri to build client context. + /// The pipeline to build client context. + /// The identifier of the resource that is the target of operations. + internal WorkloadNetworkVirtualMachine(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AVS/privateClouds/workloadNetworks/virtualMachines"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadNetworkVirtualMachineData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Get a virtual machine by id in a private cloud workload network. + /// The cancellation token to use. + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachine.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVirtualMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkVirtualMachine(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a virtual machine by id in a private cloud workload network. + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachine.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVirtualMachine(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public async virtual Task> GetAvailableLocationsAsync(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachine.GetAvailableLocations"); + scope.Start(); + try + { + return await ListAvailableLocationsAsync(ResourceType, cancellationToken).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Lists all available geo-locations. + /// A token to allow the caller to cancel the call to the service. The default value is . + /// A collection of locations that may take multiple service requests to iterate over. + public virtual IEnumerable GetAvailableLocations(CancellationToken cancellationToken = default) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachine.GetAvailableLocations"); + scope.Start(); + try + { + return ListAvailableLocations(ResourceType, cancellationToken); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs new file mode 100644 index 000000000000..f2aa22b02764 --- /dev/null +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineCollection.cs @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Core; + +namespace Azure.ResourceManager.Avs +{ + /// A class representing collection of WorkloadNetworkVirtualMachine and their operations over its parent. + public partial class WorkloadNetworkVirtualMachineCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _clientDiagnostics; + private readonly WorkloadNetworksRestOperations _workloadNetworksRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadNetworkVirtualMachineCollection() + { + } + + /// Initializes a new instance of the class. + /// The resource representing the parent resource. + internal WorkloadNetworkVirtualMachineCollection(ArmResource parent) : base(parent) + { + _clientDiagnostics = new ClientDiagnostics(ClientOptions); + _workloadNetworksRestClient = new WorkloadNetworksRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != PrivateCloud.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, PrivateCloud.ResourceType), nameof(id)); + } + + // Collection level operations. + + /// Get a virtual machine by id in a private cloud workload network. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public virtual Response Get(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Get"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualMachineId, cancellationToken); + if (response.Value == null) + throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVirtualMachine(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a virtual machine by id in a private cloud workload network. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetAsync(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Get"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVirtualMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualMachineId, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); + return Response.FromValue(new WorkloadNetworkVirtualMachine(Parent, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public virtual Response GetIfExists(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.GetVirtualMachine(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualMachineId, cancellationToken: cancellationToken); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVirtualMachine(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public async virtual Task> GetIfExistsAsync(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.GetVirtualMachineAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return Response.FromValue(null, response.GetRawResponse()); + return Response.FromValue(new WorkloadNetworkVirtualMachine(this, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public virtual Response Exists(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Exists"); + scope.Start(); + try + { + var response = GetIfExists(virtualMachineId, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Tries to get details for this resource from the service. + /// Virtual Machine identifier. + /// The cancellation token to use. + /// is null. + public async virtual Task> ExistsAsync(string virtualMachineId, CancellationToken cancellationToken = default) + { + if (virtualMachineId == null) + { + throw new ArgumentNullException(nameof(virtualMachineId)); + } + + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.Exists"); + scope.Start(); + try + { + var response = await GetIfExistsAsync(virtualMachineId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List of virtual machines in a private cloud workload network. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListVirtualMachines(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkVirtualMachine(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.GetAll"); + scope.Start(); + try + { + var response = _workloadNetworksRestClient.ListVirtualMachinesNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkVirtualMachine(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); + } + + /// List of virtual machines in a private cloud workload network. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + async Task> FirstPageFunc(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListVirtualMachinesAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkVirtualMachine(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope("WorkloadNetworkVirtualMachineCollection.GetAll"); + scope.Start(); + try + { + var response = await _workloadNetworksRestClient.ListVirtualMachinesNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new WorkloadNetworkVirtualMachine(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + + // Builders. + // public ArmBuilder Construct() { } + } +} diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs similarity index 62% rename from sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs rename to sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs index 36a58f0e21bb..9f6ac4748e56 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Models/WorkloadNetworkVirtualMachine.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/WorkloadNetworkVirtualMachineData.cs @@ -5,26 +5,27 @@ #nullable disable -using Azure.ResourceManager; +using Azure.Core; +using Azure.ResourceManager.Avs.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Avs.Models +namespace Azure.ResourceManager.Avs { - /// NSX Virtual Machine. - public partial class WorkloadNetworkVirtualMachine : Resource + /// A class representing the WorkloadNetworkVirtualMachine data model. + public partial class WorkloadNetworkVirtualMachineData : Resource { - /// Initializes a new instance of WorkloadNetworkVirtualMachine. - public WorkloadNetworkVirtualMachine() + /// Initializes a new instance of WorkloadNetworkVirtualMachineData. + public WorkloadNetworkVirtualMachineData() { } - /// Initializes a new instance of WorkloadNetworkVirtualMachine. + /// Initializes a new instance of WorkloadNetworkVirtualMachineData. /// The id. /// The name. /// The type. /// Display name of the VM. /// Virtual machine type. - internal WorkloadNetworkVirtualMachine(ResourceIdentifier id, string name, ResourceType type, string displayName, VMTypeEnum? vmType) : base(id, name, type) + internal WorkloadNetworkVirtualMachineData(ResourceIdentifier id, string name, ResourceType type, string displayName, VMTypeEnum? vmType) : base(id, name, type) { DisplayName = displayName; VmType = vmType; From 335cdcff18821666bc68c516115371a4635b3a3e Mon Sep 17 00:00:00 2001 From: Cameron Taggart Date: Tue, 18 Jan 2022 12:16:29 -0500 Subject: [PATCH 7/7] operation-group no longer used by autorest.csharp --- .../Azure.ResourceManager.Avs/src/autorest.md | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md b/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md index 6d4a7ce282df..fec625fc446b 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md +++ b/sdk/avs/Azure.ResourceManager.Avs/src/autorest.md @@ -11,29 +11,4 @@ security: AADToken require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/c4d6f92d3fd35a69ebce68f4c73c35c4238c2ac5/specification/vmware/resource-manager/readme.md tag: package-2021-12-01 model-namespace: false -operation-group-to-resource-type: - Locations: Microsoft.AVS/locations - ScriptCmdlets: Microsoft.AVS/privateClouds/scriptPackages/scriptCmdlets - ScriptPackages: Microsoft.AVS/privateClouds/scriptPackages - VirtualMachines: Microsoft.AVS/privateClouds/clusters/virtualMachines -operation-group-to-parent: - Locations: subscriptions - WorkloadNetworks: Microsoft.AVS/privateClouds -operation-group-to-resource: -# Addons: NonResource -# Authorizations: NonResource -# CloudLinks: NonResource -# Clusters: NonResource -# Datastores: NonResource -# GlobalReachConnections: NonResource -# HcxExterpriseSites: NonResource - Locations: NonResource -# Operations: NonResource -# PlacementPolicies: NonResource -# PrivateClouds: NonResource - ScriptCmdlets: NonResource - ScriptExecutions: NonResource - ScriptPackages: NonResource - VirtualMachines: NonResource - WorkloadNetworks: NonResource ```